[英]Android focus from one LinearLayout to another LinearLayout on next pressing next button
What I required is to change the focus from Edittext1
to LinearLayout1
and the from LinearLayout1
to LinearLayout2
and the from LinearLayout2
to Edittext2
我需要的是改变重点从Edittext1
到LinearLayout1
和从LinearLayout1
到LinearLayout2
和从LinearLayout2
到Edittext2
I am not sure is this the valid to focus from one LinearLayout to another LinearLayout 我不确定这是否可以有效地从一个LinearLayout聚焦到另一个LinearLayout
Following is the xml file: 以下是xml文件:
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:scrollbars="none" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/ll_welcome_txt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="vertical" >
<EditText
android:id="@+id/editShowerName"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:hint="Ghost Event Name"
android:inputType="text|textCapWords|textAutoCorrect|textAutoComplete" >
</EditText>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="125dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="12dp" >
<kankan.wheel.widget.WheelView
android:id="@+id/month"
android:layout_width="120dip"
android:layout_height="fill_parent" />
<kankan.wheel.widget.WheelView
android:id="@+id/day"
android:layout_width="50dp"
android:layout_height="fill_parent" />
<kankan.wheel.widget.WheelView
android:id="@+id/year"
android:layout_width="wrap_content"
android:layout_height="fill_parent" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="125dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="12dp" >
<kankan.wheel.widget.WheelView
android:id="@+id/wv_hours"
android:layout_width="40dip"
android:layout_height="fill_parent" />
<kankan.wheel.widget.WheelView
android:id="@+id/wv_minutes"
android:layout_width="40dip"
android:layout_height="fill_parent" />
<kankan.wheel.widget.WheelView
android:id="@+id/wv_am_pm"
android:layout_width="wrap_content"
android:layout_height="fill_parent" />
</LinearLayout>
<EditText
android:id="@+id/editDurationHours"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_weight=".5"
android:hint="Hours"
android:singleLine="true" />
</LinearLayout>
</ScrollView>
here I am able to get focus from Edittext to LinearLayout using android:imeOptions="actionNext"
for editText but this attritube is not supported by LinearLayout.. 在这里,我可以使用android:imeOptions="actionNext"
for editText将焦点从Edittext转到LinearLayout,但是LinearLayout不支持此attritube。
So how can move focus from one linear to another linear layout on pressing next button of device keyboard.Any kind of suggestion will be appreciate.Thanks in advance 因此,如何在按下设备键盘的下一个按钮时将焦点从一种线性布局转移到另一种线性布局,任何建议都将不胜感激。
In my experience, I needed both these lines for focus to actually work (especially for LinearLayouts). 以我的经验,我需要这两行内容才能使焦点真正起作用(尤其是对于LinearLayouts)。
<LinearLayout
...
android:clickable="true"
android:focusable="true"
/>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.