首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
社区首页 >问答首页 >将焦点从一个布局中的一个EditText移到另一个布局中的另一个EditText

将焦点从一个布局中的一个EditText移到另一个布局中的另一个EditText
EN

Stack Overflow用户
提问于 2016-09-03 11:43:23
回答 1查看 721关注 0票数 1

enter image description here

我正在构建这个应用程序,我希望用户使用软键盘的下一步按钮来改变EditTexts的焦点,就像图片一样,但它只是将我使用的第一列的焦点一直向下移动

代码语言:javascript
运行
AI代码解释
复制
android:nextFocussForward 

使用所需的id EditText,但它不起作用(nextfoucusleft/right/up/down不起作用)

它包含一个父级垂直线性布局每行都是水平线性布局

下面是XML:

代码语言:javascript
运行
AI代码解释
复制
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:orientation="vertical"
    tools:context=".MainActivity">
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:background="@color/header"
    >
    <TextView
        android:text="@string/ecrit"
        android:layout_height="wrap_content"
        android:layout_width="0dp"
        android:layout_weight="1"
        android:textSize="@dimen/text_size_label"
        android:textAlignment="center"/>
    <TextView
        android:text="@string/orale"
        android:layout_height="wrap_content"
        android:layout_width="0dp"
        android:textSize="@dimen/text_size_label"
        android:layout_weight="1" />
    <TextView
        android:text="@string/lecture"
        android:layout_height="wrap_content"
        android:layout_width="0dp"
        android:textSize="@dimen/text_size_label"
        android:layout_weight="1"/>

</LinearLayout>
<LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/cells"
       >
        <EditText
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:id="@+id/ecrit1"
            android:inputType="number"
            android:maxLength="3"
            />
        <EditText
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:id="@+id/orale1"
            android:inputType="number"
            android:maxLength="3"/>
        <EditText
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:id="@+id/lecture1"
            android:inputType="number"
            android:maxLength="3"/>
</LinearLayout>
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/cells"
    >
    <EditText
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:id="@+id/ecrit2"
        android:inputType="number"
        android:maxLength="3"/>
    <EditText
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:id="@+id/orale2"
        android:inputType="number"
        android:maxLength="3"
        />
    <EditText
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:id="@+id/lecture2"
        android:inputType="number"
        android:maxLength="3"/>
</LinearLayout>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/cells"
        >
        <EditText
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:id="@+id/ecrit3"
            android:inputType="number"
            android:maxLength="3"
            android:nextFocusRight="@id/orale1"
            android:nextFocusForward="@id/orale1"
            android:nextFocusDown="@id/orale1"
            android:nextFocusUp="@id/orale1"
            android:nextFocusLeft="@id/orale1"
            />
        <EditText
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:id="@+id/orale3"
            android:inputType="number"
            android:maxLength="3"/>
        <EditText
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:id="@+id/lecture3"
            android:inputType="number"
            android:maxLength="3"/>
    </LinearLayout>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:background="@color/result"
       >
        <TextView
            android:paddingLeft="8dp"
            android:text="@string/zero"
            android:layout_height="wrap_content"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:textSize="@dimen/text_size_label"
            android:textAlignment="center"/>
        <TextView
            android:paddingLeft="8dp"
            android:text="@string/zero"
            android:layout_height="wrap_content"
            android:layout_width="0dp"
            android:textSize="@dimen/text_size_label"
            android:layout_weight="1" />
        <TextView
            android:paddingLeft="8dp"
            android:text="@string/zero"
            android:layout_height="wrap_content"
            android:layout_width="0dp"
            android:textSize="@dimen/text_size_label"
            android:layout_weight="1"/>

    </LinearLayout>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:layout_marginTop="15dp"
        android:background="@color/header"
        >
        <TextView
            android:text="@string/examen_ecrit"
            android:layout_height="wrap_content"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:textSize="@dimen/text_size_label"
            android:textAlignment="center"/>
        <TextView
            android:text="@string/examen_orale"
            android:layout_height="wrap_content"
            android:layout_width="0dp"
            android:textSize="@dimen/text_size_label"
            android:layout_weight="1" />
        <TextView
            android:text="@string/examen_finale"
            android:layout_height="wrap_content"
            android:layout_width="0dp"
            android:textSize="@dimen/text_size_label"
            android:layout_weight="1"/>
        </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/cells"
        >
        <EditText
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:id="@+id/ecritFinal"
            android:inputType="number"
            android:maxLength="3"/>
        <EditText
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:id="@+id/oraleFinal"
            android:inputType="number"
            android:maxLength="3"/>
        <EditText
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:id="@+id/finaleFinal"
            android:inputType="number"
            android:maxLength="3"/>
    </LinearLayout>

    <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:layout_marginTop="15dp"
    >
    <TextView
        android:layout_width="0dp"
        android:layout_weight="1"
        android:layout_height="match_parent"
        android:background="@color/header"
        android:text="@string/classactivity"
        android:textSize="@dimen/text_size_label"/>
    <TextView
        android:textSize="@dimen/text_size_label"
        android:layout_width="0dp"
        android:layout_weight="1"
        android:layout_height="match_parent"
        android:background="@color/result"
        android:text="@string/zero"/>
</LinearLayout>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:layout_marginTop="15dp"
        >
        <TextView
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="match_parent"
            android:background="@color/header"
            android:text="@string/finalgrade"
            android:textSize="@dimen/text_size_label"/>
        <TextView
            android:textSize="@dimen/text_size_label"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="match_parent"
            android:background="@color/result"
            android:text="@string/zero"/>
    </LinearLayout>

</LinearLayout>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-09-03 12:45:00

尝试使用android:imeAction = "actionNext"android:nextFocussForward

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39306512

复制
相关文章
Android中EditText
1.android:hint="只能输入指定数字",文本框中显示提示信息 2.android:password="true"该文本框是一个密码框 3.android:phoneNumber="true"该文本框是一个电话框 4.android:digits="abcdefghijk"指输入内容限制为指定内容 5.android:drawableLeft="@drawable/icon"设置文本左边绘制指定图像 6.android:drawablePadding设置文本框内文本与图形间的间距 7.androi
欢醉
2018/01/22
7490
android RecyclerView 里面嵌套editText,点击RecyclerView内部其他控件让editText失去焦点
有很多方法,没详细去尝试,而我的方法是在每个item添加一个hideKeyboard,hideKeyboard是自定义方法,此方法写在activity中
用户10521372
2023/05/24
1.6K0
Hexo中引入另一个文件内容
程序员朱永胜
2023/09/15
1450
Edittext In Listview,当listview的item中有edittext时,怎么保存edittext的值?
http://blog.csdn.net/lxk_1993/article/details/50527886
103style
2022/12/19
8680
Edittext In Listview,当listview的item中有edittext时,怎么保存edittext的值?
使用VBA将图片从一个工作表移动到另一个工作表
今天跟大家分享的技巧来自thesmallman.com,一个分享Excel技巧技术的网站。
fanjy
2022/11/16
4K0
使用VBA将图片从一个工作表移动到另一个工作表
android 在一个应用中启动另一个应用android 在一个应用中启动另一个应用
在程序开发过程当中,常遇到需要启动另一个应用程序的情况,比如在点击软件的一个按钮可以打开地图软件。
一个会写诗的程序员
2018/08/20
5260
Android EditText 获得输入焦点 以及requestfocus()失效的问题
 最近做公司项目的时候,经常会遇到一个问题,就是我为某个控件如EditText设置requestfocus()的时候不管用,比如说登陆的时候,我判断下用户输入的密码,如果正确就登陆,错误就提示密码错误,并且输入框获取焦点,但是实际中确不起作用 package com.example.hfs.requestfocusdemo; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import andr
庞小明
2018/03/08
3.1K0
python一个类中调用另一个类的方法
# 创建一个A类 class A: def a(self): return print('这里是A类') class B: # 实例化A类达到调用目的 def run_a(self): self.a=A() self.a.a() # 这样就调用到了a类的方法了 # 继承自A类,什么是继承,请自行百度 直达链接 class C(A): pass c=C() # 实例化C类 # 有了继承自A的方法,所以直接使用A类
kirin
2020/05/19
11.5K0
EditText在RecyclerView中的解决方案
有时候,一个列表中的Item会有EditText的出现,而由于View复用机制,如果不好好处理EditText,将会出现一些问题。之前做项目中也遇到了这个问题,通过摸索以及思考,最终得到了解决方案。
用户1108631
2019/08/14
2.8K0
EditText的监听
用户1148523
2018/01/09
1.1K0
get的过程中另一个线程删除一个entry
假设我们的链表元素是:e1-> e2 -> e3 -> e4 我们要删除 e3这个entry   因为HashEntry中next的不可变,所以我们无法直接把e2的next指向e4,而是将要删除的节点之前的节点复制一份,形成新的链表。它的实现大致如下图所示:
用户7365393
2021/10/08
4910
在JSP页面中调用另一个JSP页面中的变量
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/huyuyang6688/article/details/16896447
DannyHoo
2018/09/13
7.9K0
关于RecyclerView中嵌套EditText引发的问题总结
最近在开发一个基于RecycelrView的编辑器, Recyclerview中包含Edittext在滚动时会发生数据混乱的问题,之所以数据混乱就是因为Recyclerview的复用导致的。
易帜
2022/09/23
2.3K0
get的过程中另一个线程恰好新增entry
ConcurrentHashMap完全允许多个读操作并发进行,读操作并不需要加锁。关键是用 HashEntry 对象的不变性来降低读操作对加锁的需求。只是判断获取的entry的value是否为null,为null时才使用加锁的方式再次去获取。   在代码清单“HashEntry 类的定义”中我们可以看到,HashEntry 中的 key,hash,next 都声明为 final 型。这意味着,不能把节点添加到链接的中间和尾部,也不能在链接的中间和尾部删除节点。这个特性可以保证:在访问某个节点时,这个节点之后的链接不会被改变。这个特性可以大大降低处理链表时的复杂性。 下面分析在get的时候的线程安全性
用户7365393
2021/10/08
2200
kettle实现从一个cassandra同步到另一个cassandra
1、拖拽cassandra input、cassandra output控件到工作区,如下图所示:
johnhuster的分享
2022/03/28
7390
kettle实现从一个cassandra同步到另一个cassandra
java从一个目录拷贝文件到另一个目录下
** * 复制单个文件 * @param oldPath String 原文件路径 如:c:/fqf.txt * @param newPath String 复制后路径 如:f:/fqf.txt * @return boolean */ public void copyFile(String oldPath, String newPath) { try { int bytesum = 0; int byteread = 0; File oldfile = new File(oldPath
shirayner
2018/08/10
1K0
点击加载更多

相似问题

将焦点从一个EditText移到另一个

40

获取另一个布局中的EditText的值

232

从Edittext获取文本另一个布局

10

EditText被移到布局的底部

11

当另一个EditText清除焦点时,停止EditText获得焦点

21
添加站长 进交流群

领取专属 10元无门槛券

AI混元助手 在线答疑

扫码加入开发者社群
关注 腾讯云开发者公众号

洞察 腾讯核心技术

剖析业界实践案例

扫码关注腾讯云开发者公众号
领券
社区富文本编辑器全新改版!诚邀体验~
全新交互,全新视觉,新增快捷键、悬浮工具栏、高亮块等功能并同时优化现有功能,全面提升创作效率和体验
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档
查看详情【社区公告】 技术创作特训营有奖征文