For this you can use the dimens.xml files in the values folders.
For example, you have an Imageview.
<ImageView
android:layout_width="@dimen/imageview_width"
android:layout_height="@dimen/imageview_height"
/>
So in the values-mdpi folder, for example, you create the dimens.xml file and put:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="imageview_width">30dp</dimen>
<dimen name="imageview_height">30dp</dimen>
</resources>
Then you create in the values-xlarge folder, the same file, but put other values:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="imageview_width">60dp</dimen>
<dimen name="imageview_height">60dp</dimen>
</resources>
You can create the dimens files in various folder combinations, for example values-normal-hdpi.
Another option would be to use the weight field of the Linearlayout component. For example:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:weightSum="10" >
<ImageView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3" />
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="7" />
</LinearLayout>
So the components will always occupy the same percentages of the screen, regardless of its size.
How does this weight work? Why 10 in the first? 3 in the second, and 7 in the third?
– War Lock
These are just sample values. You define in Linearlayout what your maximum size will be. And then divide the weight into his children. @Warlock
– Helder
I made the changes in xml, and saw no changes, which may be?
– War Lock
Which of the two ways did you do it? @Warlock
– Helder
the second, because it seems simpler
– War Lock
put the layout code please
– Helder
I posted the code, I tried several values but it doesn’t change anything.
– War Lock
You need to put width as 0 dp
– Helder
If you put 0 of the error: Suspicious size: this will make the view Invisible
– War Lock
You put in the "father" of your android Imageview:weightSum?
– Helder
I put it the way you put it on Linearlayout android:weightSum="10"
– War Lock
place the entire block of the layout then please
– Helder
I can not post all the code, only the image view part appears, follow on Stebin: http://pastebin.com/ZRJ7VsyT
– War Lock
Let’s go continue this discussão in chat.
– War Lock