典型「第三方登錄」區域:一行文字(如「其他方式登錄」)居中,下方三個圖標按鈕(微信、QQ、微博)等寬分佈,底部留白。
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center_horizontal"
android:padding="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="其他方式登錄"
android:textColor="#999999"
android:textSize="14sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="12dp"
android:gravity="center">
<ImageButton
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/ic_wechat"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="微信登錄" />
<ImageButton
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/ic_qq"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="QQ登錄" />
<ImageButton
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/ic_weibo"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="微博登錄" />
</LinearLayout>
</LinearLayout>
layout_width="0dp" + layout_weight="1":三個按鈕**等寬佔滿父容器**,自適應螢幕寬度。background="?attr/selectableItemBackgroundBorderless"`:點擊回饋波紋效果,無邊框干擾。contentDescription:無障礙支持,通過無障礙掃描。若項目已遷移至 ConstraintLayout,可用 `app:layout_constraintHorizontal_chainStyle="spread_inside"` 實現鏈式等寬分佈,層級更扁平。