将EditText imeOptions设置为actionNext不起作用 [英] Setting EditText imeOptions to actionNext has no effect

查看:967
本文介绍了将EditText imeOptions设置为actionNext不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个相当复杂的(不是真正的)xml布局文件。其中一个视图是带有两个子元素的LinearLayout( v1 ):一个EditText( v2 )和另一个LinearLayout code> V3 )。子代LinearLayout又有一个EditText( v4 )和一个ImageView( v5 )。



对于EditText v2我有imeOptions作为

  android:imeOptions =actionNext

但是当我运行应用程序时,键盘的 return 不要检查下一步,我希望它变成下一步。如何解决这个问题?



另外,当用户点击下一个时,我想专注于EditText v4。对于那些真的需要看到一些代码的人来说:

  

code>< LinearLayout
android:id =@ + id / do_txt_view
android:layout_width =match_parent
android:layout_height =wrap_content
android :background =@ color / col6
android:orientation =vertical
android:visibility =gone>

编辑文本
android:id =@ + id / gm_title
android:layout_width =match_parent
android:layout_height =wrap_content
android:layout_margin =5dp
android:background =@ drawable / coldo_text
android:hint =@ string / enter_title
android:maxLines =1
android:imeOptions =actionNext
android:padding =5dp
android:textColor =pigc7
android:textSize =ads2/>

< LinearLayout
android:layout_width =match_parent
android:layout_height =100dp
android:orientation =horizo​​ntal>

编辑文本
android:id =@ + id / rev_text
android:layout_width =0dp
android:layout_height =match_parent
android:layout_gravity =center_vertical
android:layout_margin =5dp
android:layout_weight =1
android:background =@ drawable / coldo_text
android :hint =@ string / enter_msg
android:maxLines =2
android:padding =5dp
android:textColor =pigc7 ads2/>

< ImageView
android:layout_width =wrap_content
android:layout_height =match_parent
android:layout_gravity =center_vertical
android:
android:clickable =true
android:onClick =clickAct
android:paddingLeft =5dp
android:paddingRight = 5dp
android:src =@ drawable / abcat/>
< / LinearLayout>
< / LinearLayout>


解决方案

只需添加 android:maxLines =1& android:inputType =text到你的EditText。它会工作! :)

I have a fairly complex (not really) xml layout file. One of the views is a LinearLayout (v1) with two children: an EditText(v2) and another LinearLayout(v3). The child LinearLayout in turn has an EditText(v4) and an ImageView(v5).

For EditText v2 I have imeOptions as

android:imeOptions="actionNext"

But when I run the app, the keyboard's return does not check to next and I want it to change to next. How do I fix this problem?

Also, when user clicks next, I want focus to go to EditText v4. I do I do this?

For those who really need to see some code:

<LinearLayout
        android:id="@+id/do_txt_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/col6"
        android:orientation="vertical"
        android:visibility="gone" >

        <EditText
            android:id="@+id/gm_title"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="5dp"
            android:background="@drawable/coldo_text"
            android:hint="@string/enter_title"
            android:maxLines="1"
            android:imeOptions="actionNext"
            android:padding="5dp"
            android:textColor="pigc7"
            android:textSize="ads2" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="100dp"
            android:orientation="horizontal" >

            <EditText
                android:id="@+id/rev_text"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_gravity="center_vertical"
                android:layout_margin="5dp"
                android:layout_weight="1"
                android:background="@drawable/coldo_text"
                android:hint="@string/enter_msg"
                android:maxLines="2"
                android:padding="5dp"
                android:textColor="pigc7"
                android:textSize="ads2" />

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_gravity="center_vertical"
                android:background="@drawable/colbtn_r"
                android:clickable="true"
                android:onClick="clickAct"
                android:paddingLeft="5dp"
                android:paddingRight="5dp"
                android:src="@drawable/abcat" />
        </LinearLayout>
    </LinearLayout>

解决方案

Just add android:maxLines="1" & android:inputType="text" to your EditText. It will work!! :)

这篇关于将EditText imeOptions设置为actionNext不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆