本例和上例类似,只是将其中一个子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;">

更多相关文章

  1. android全屏,去掉title栏的办法
  2. Android(安卓)uri转Bitmap
  3. 2011.10.19(2)——— android 圆角与倒影
  4. Android(安卓)图片拖动和缩放
  5. Android图片剪裁-调用系统实现,完美适配魅族等机型
  6. Android(安卓)Studio Gradle多渠道打包(动态设定App名称,应用图标
  7. 去掉tabhost横线
  8. [置顶] 我的Android进阶之旅------>Android(安卓)Widget 桌面数
  9. Android(安卓)去掉自定义dialog的白色边框

随机推荐

  1. java.lang.BootstrapMethodError: Except
  2. Android前端RxJava2+Retrofit2;后端Spring
  3. 【5年Android从零复盘系列之五】关于页面
  4. android fragment android.support.v4.ap
  5. Android:通过ValueAnimator动画改变控件长
  6. 关于 Android 进程保活,你所需要知道的一
  7. 【Android】Android Studio 使用第三方类
  8. Ubuntu上adb找不到设备问题小结
  9. 深入理解Android工程的编译过程
  10. 修改Android actionbar 溢出菜单按钮(Over