In my xml file I set each small circle (ImageView) to be the size of 25% of the screen with a Linear View and layout_weights.
| Here is a screen shot from my phone (how it is supposed to look) | On my tablet it does not change the size to be 25% of the screen (this is how it looks) |
|---|---|
![]() | ![]() |
My code consists of three LinearLayout's each containing ImageView's with weights of 0.25 out of 1.
Here is the code:
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" xmlns:ads="http://schemas.android.com/apk/res-auto"> <ImageView android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/imageView12" android:src="@drawable/circle_big" android:layout_centerVertical="true" android:layout_centerHorizontal="true" /> <LinearLayout android:id="@+id/wrapper" android:layout_width="fill_parent" android:layout_height="wrap_content" android:weightSum="1.0" android:layout_centerVertical="true" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_alignParentRight="true" android:layout_alignParentEnd="true"> <FrameLayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="0.03125" /> <ImageView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="0.25" android:id="@+id/imageView12" android:src="@drawable/circle_white" android:onClick="changeToScreenSelectLayout" android:scaleType="fitCenter" android:adjustViewBounds="true" /> <FrameLayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="0.09375" /> <ImageView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="0.25" android:id="@+id/imageView12" android:src="@drawable/circle_white" android:onClick="changeToScreenSelectLayout" android:scaleType="fitCenter" android:adjustViewBounds="true" /> <FrameLayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="0.09375" /> <ImageView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="0.25" android:id="@+id/imageView12" android:src="@drawable/circle_white" android:onClick="changeToScreenSelectLayout" android:scaleType="fitCenter" android:adjustViewBounds="true" /> <FrameLayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="0.03125" /> </LinearLayout> <LinearLayout android:id="@+id/wrapper" android:layout_width="fill_parent" android:layout_height="wrap_content" android:weightSum="1.0" android:layout_centerVertical="true" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_alignParentRight="true" android:layout_alignParentEnd="true" android:rotation = "120"> <FrameLayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="0.03125" /> <ImageView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="0.25" android:id="@+id/imageView12" android:src="@drawable/circle_white" android:onClick="changeToScreenSelectLayout" android:scaleType="fitCenter" android:adjustViewBounds="true" /> <FrameLayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="0.4375" /> <ImageView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="0.25" android:id="@+id/imageView12" android:src="@drawable/circle_white" android:onClick="changeToScreenSelectLayout" android:scaleType="fitCenter" android:adjustViewBounds="true" /> <FrameLayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="0.03125" /> </LinearLayout> <LinearLayout android:id="@+id/wrapper" android:layout_width="fill_parent" android:layout_height="wrap_content" android:weightSum="1.0" android:layout_centerVertical="true" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_alignParentRight="true" android:layout_alignParentEnd="true" android:rotation = "60"> <FrameLayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="0.03125" /> <ImageView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="0.25" android:id="@+id/imageView12" android:src="@drawable/circle_white" android:onClick="changeToScreenSelectLayout" android:scaleType="fitCenter" android:adjustViewBounds="true" /> <FrameLayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="0.4375" /> <ImageView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="0.25" android:id="@+id/imageView12" android:src="@drawable/circle_white" android:onClick="changeToScreenSelectLayout" android:scaleType="fitCenter" android:adjustViewBounds="true" /> <FrameLayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="0.03125"/> </LinearLayout> </RelativeLayout> 
