1
You can use the attribute layout_weight
(weight) in each view, assigning the value 0.7
representing 70% and 0.3
representing 30%. See an example:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.7">
<!--seu conteúdo aqui-->
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.3">
<!--seu conteúdo aqui-->
</LinearLayout>
</LinearLayout>
Only works with Linearlayout?
– Maria Canelas
@Humbertovieira for this case, I believe so. However android:layout_weight is used in Edittext, Buttons etc.
– viana