当前位置:操作系统 > 安卓/Android >>

Android ApiDemos示例解析(138):Views->Layouts->Baseline->6. Relative

本例将一个TextView 和父RelativeLayout 左,上对齐,然后就另一个View和它设置baseline对齐:

<RelativeLayout xmlns:android=”http://schemas.android.com/apk/res/android”
android:layout_width=”match_parent”
android:layout_height=”match_parent”>

<TextView android:id=”@+id/anchor”
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:layout_alignParentTop=”true”
android:layout_alignParentLeft=”true”
android:textStyle=”bold”
android:text=”@string/baseline_7_fat” />

<TextView
android:layout_width=”wrap_content”
android:layout_alignParentRight=”true”
android:layout_alignBaseline=”@id/anchor”
android:layout_height=”wrap_content”
android:text=”@string/baseline_7_lean” />

</RelativeLayout>


 

\
补充:移动开发 , Android ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,