线性布局(重点)

阅读 39

2022-04-04

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="match_parent">


    <!--vertical:垂直的  horizontal:水平的-->
    <!--layout_weight:权重-->

    <TextView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:text="慕课慕课慕课慕课慕课慕课"
        android:background="#ff0000"
        android:layout_weight="1"
        android:textSize="28sp"
        android:layout_gravity="right"/>

    <TextView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:text="慕课"
        android:background="#00ff00"
        android:layout_weight="1"
        android:textSize="28sp"
        android:layout_gravity="center"/>
    <TextView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:text="慕课"
        android:background="#0000ff"
        android:layout_weight="1"
        android:textSize="28sp"/>
</LinearLayout>

 

精彩评论(0)

0 0 举报