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

Android ApiDemos示例解析(116):Views->Focus->2. Horizontal

本例横向显示UI控件,并使用了nextFocusRight 明确为Button 指定按右键时下一个获取焦点的UI控件为rightButton (跳过中间的Button),但是从右到左时还是按照缺省顺序。

<LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android”
android:layout_height=”wrap_content”
android:layout_width=”match_parent”
android:orientation=”horizontal”>

<Button android:id=”@+id/leftButton”
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:layout_marginRight=”3dip”
android:text=”@string/focus_2_left”
android:nextFocusRight=”@+id/rightButton”/>  <!– jump over middle! –>

<Button android:id=”@+id/centerButton”
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:layout_marginRight=”3dip”
android:text=”@string/focus_2_jump” />

<Button android:id=”@+id/rightButton”
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:layout_marginRight=”3dip”
android:text=”@string/focus_2_right”/>

</LinearLayout>

 

\


作者:mapdigit
 


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