线性布局与相对布局的嵌套
生活随笔
收集整理的這篇文章主要介紹了
线性布局与相对布局的嵌套
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
只是顯示界面。
一個基礎的嵌套使用
示例代碼:
<?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:layout_gravity="center_vertical"><ImageViewandroid:id="@+id/imageview1"android:layout_width="100dp"android:layout_height="100dp"android:padding="5dp"android:src="@drawable/cat"/><TextViewandroid:id="@+id/textView_appName"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginTop="30dp"android:text="應用名稱"android:textSize="30sp"/><RelativeLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:gravity="right"android:padding="10dp" ><TextViewandroid:id="@+id/textView_rating"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="5.0" /><RatingBarandroid:id="@+id/ratingBar"android:layout_width="wrap_content"android:layout_height="wrap_content"android:numStars="5"style="?android:attr/ratingBarStyleSmall"android:layout_below="@id/textView_rating"/></RelativeLayout>> </LinearLayout>總結
以上是生活随笔為你收集整理的线性布局与相对布局的嵌套的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 相对布局(RelativeLayout)
- 下一篇: 股市止损37定律 损失超30%要及时抽身