最近去了一家新公司,然後開始做新的項目,看其代碼發現了一個很巧妙的方法來實作圖檔在上面文字在下面的布局方式。隻需要一個控件——RadioButton。
布局檔案很簡單,用來展示RadioBUtton的使用方法。
1 <?xml version="1.0" encoding="utf-8"?>
2 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:layout_width="match_parent"
4 android:layout_height="match_parent"
5 android:orientation="vertical" >
6
7 <RadioButton
8 android:layout_width="wrap_content"
9 android:layout_height="wrap_content"
10 android:layout_centerInParent="true"
11 android:button="@null"
12 android:drawableTop="@drawable/ic_launcher"
13 android:text="Test Button" />
14
15 </RelativeLayout>
效果圖如下
簡直就是Perfect啊。
轉載于:https://www.cnblogs.com/mc-ksuu/p/4967319.html