<LinearLayout> android:layout_weight
horizontal
(1:1:1:1:1)
【activity_main.xml】
As the following code:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" tools:context=".MainActivity">
<TextView android:layout_width="0dp" android:layout_height="match_parent" android:text="Test1" android:background="#1e90ff" android:layout_weight="1"/>
<TextView android:layout_width="0dp" android:layout_height="match_parent" android:text="Test2" android:background="#00bfff" android:layout_weight="1"/> <TextView android:layout_width="0dp" android:layout_height="match_parent" android:text="Test3" android:background="#87cefa" android:layout_weight="1"/> <TextView android:layout_width="0dp" android:layout_height="match_parent" android:text="Test4" android:background="#e0ffff" android:layout_weight="1"/> <TextView android:layout_width="0dp" android:layout_height="match_parent" android:text="Test5" android:background="#f0ffff" android:layout_weight="1"/>
</LinearLayout>
|