Android(安卓)ApiDemos示例解析(139):Views->Layouts->Baseline->Nested Example 2
本例和上例类似,只是将其中一个子LinearLayout的orientation从vertical 改成horizontal,同样去掉android:layout_gravity=”center_vertical”
<LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android”
android:orientation=”horizontal”
android:layout_width=”match_parent”
android:layout_height=”match_parent”>
<TextView
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:layout_marginRight=”3dip”
android:text=”@string/baseline_nested_1_label” />
<!– We want the middle textview of this vertical linear layout to
be baseline aligned with the others.–>
<LinearLayout
android:orientation=”vertical”
android:baselineAlignedChildIndex=”1″
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
>
<ImageView
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:src=”@drawable/arrow_up_float”/>
<TextView
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:layout_marginRight=”5dip”
android:text=”@string/baseline_nested_1_label” />
<ImageView
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:src=”@drawable/arrow_down_float”/>
</LinearLayout>
<!– We want the third index textview of this vertical linear layout to
be baseline aligned with the others.–>
<LinearLayout
android:orientation=”horizontal”
android:baselineAlignedChildIndex=”2″
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”>
<ImageView
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:src=”@drawable/arrow_up_float”/>
<ImageView
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:src=”@drawable/arrow_up_float”/>
<TextView
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:layout_marginRight=”5dip”
android:text=”@string/baseline_nested_1_label” />
</LinearLayout>
<TextView
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:textSize=”20sp”
android:text=”@string/baseline_nested_1_label” />
</LinearLayout>
Layouts->Baseline->Nested Example 2_第1张图片" src="https://img.it610.com/image/info5/e60bd451d305442a9a22f39b5d602efd.jpg" width="330" height="491" style="font:inherit; margin:5px auto; padding:0px; border:currentColor; height:auto; vertical-align:baseline; display:block; max-width:100%;border:1px solid black;">
更多相关文章
- android全屏,去掉title栏的办法
- Android(安卓)uri转Bitmap
- 2011.10.19(2)——— android 圆角与倒影
- Android(安卓)图片拖动和缩放
- Android图片剪裁-调用系统实现,完美适配魅族等机型
- Android(安卓)Studio Gradle多渠道打包(动态设定App名称,应用图标
- 去掉tabhost横线
- [置顶] 我的Android进阶之旅------>Android(安卓)Widget 桌面数
- Android(安卓)去掉自定义dialog的白色边框