LinearLayout里面的空间居中对齐

<?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="vertical" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="20dp"
        android:orientation="horizontal" >

        <ImageButton
            android:id="@+id/ibToleft"
            android:layout_width="20dp"
            android:layout_height="match_parent"
            android:src="@drawable/left" 
            android:layout_margin="1dp" />
            
            <TextView
            <span style="color:#ff0000;">android:layout_width="0dp"</span>
            android:layout_height="wrap_content"
            android:text="@string/about"  
            an<span style="color:#ff0000;">droid:layout_weight="1"</span> 
            <span style="color:#ff0000;">android:gravity="center"</span>
            android:textSize="20sp"
            />

    </LinearLayout>

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scaleType="fitXY"
        android:src="@drawable/splash" />

</LinearLayout>


实现效果:


Keep it simple!
作者:N3verL4nd
知识共享,欢迎转载。
原文地址:https://www.cnblogs.com/lgh1992314/p/5834738.html