Image not focused in ActionPage on Android 320x320 wear device

In an android protection app, I have an ActionPage with images. On devices with a resolution of 280x280, images are placed in the center of the circle, but on 320x320 devices the images are shifted (see. Screenshots).

    <android.support.wearable.view.ActionPage
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/action_page"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:color="@android:color/white"
        android:background="@android:color/transparent"
        app:rippleColor="@color/kis_primary_color"
        app:imageScaleMode="fit"
        />

If the application is installed: imageScaleMode = "center" the image is placed in the center, but a white circle fills the entire screen.

The image is set in java code:

    public abstract class ButtonFragment extends Fragment {
        @Override
        public View onCreateView(final LayoutInflater inflater, 
                final ViewGroup container, final Bundle savedInstanceState) {
            final View root = inflater.inflate(R.layout.fragment_button, container, false);
            final ActionPage actionPage = (ActionPage) root.findViewById(R.id.action_page);
            actionPage.setImageResource(getImageResourceId());
            return root;
        }

The ActionPage on 320x320 should look approximately 280x280. Any ideas?enter image description here enter image description here enter image description here

+4
source share

Source: https://habr.com/ru/post/1617213/


All Articles