FrameLayout (幀布局),在實際開發中用的較少,只有在特定的場合才需要。
<?xml version="1.0" encoding="utf-8"?><FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="第1個"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="第2個"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="第3個"/></FrameLayout>上面我們建了一個幀布局(FrameLayout),其中有3個TextView控件。
看以看出:幀布局也是默認控件會重疊、左對齊、頂部對齊的。
修改TextView的對齊方式:第一個TextView右對齊并且底部對齊,第二個TextView居中對齊(垂直和水平) 
新聞熱點
疑難解答