- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我在控制对焦方面遇到了一些问题。我的接口(interface)定义如下:
来源( radio 组/可选)目的地(编辑文本)数量(编辑文本)转移(按钮)
我正在将“源代码”的可见性更改为我的代码。当我不显示它的时候,焦点会自动转到“数量”,我希望它是“目的地”。我不知道我错过了什么。我怀疑这可能是一个 Android 错误,我不知道。有没有人知道如何解决这个问题?
谢谢
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<RadioGroup android:id="@+id/source"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone">
<RadioButton android:id="@+id/default"
android:checked="false"
android:text="@string/default"/>
</RadioGroup>
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:stretchColumns="1">
<TableRow>
<TextView
android:text="@string/destination"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:textColor="#ffffff"
android:paddingRight="10sp"
android:layout_weight="1"/>
<EditText android:id="@+id/destination"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:singleLine="true"><requestFocus/></EditText>
</TableRow>
<TableRow>
<TextView
android:text="@string/quantity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:textColor="#ffffff"
android:paddingRight="10sp"
android:layout_weight="1"/>
<EditText android:id="@+id/quantity"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:singleLine="true"/>
</TableRow>
</TableLayout>
<Button android:id="@+id/transfer"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/transfer"/>
</LinearLayout>
最佳答案
这似乎是一个已知问题。以下关于 Android 项目的 google code 的帖子描述了同样的问题。
Issue 2705: Setting requestFocus on EditText prevents soft keyboard from opening
您可以尝试在您的代码中而不是在布局中设置焦点。
关于android - requestFocus 跳过下一个 EditText,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4211851/
我正在尝试从 TextInputControl 调用 requestFocus 方法。没有成功。我想在打开新选项卡时将焦点放在 TextInputControl 上。我这样做: tab.setCont
在我的 Java Swing 应用程序中,Reuestfocus 方法在构造函数中不起作用。但如果我将 requestfocus 与按钮 Action 监听器一起使用,它就会起作用。我想在表单加载时设
我的 Activity 中有一个编辑文本,想请求关注它。但是,它总是在启动 Activity 时崩溃。 Java代码: foodText = (EditText) findViewById(R.id.
我希望我的应用程序中的 EditText 在应用程序启动时默认具有光标。我尝试使用 还有 userIdInput = (EditText)findViewById(R.id.idInpu
在上面的标记中 不起作用。 Activity 启动时, TextView 未获得焦点。这是因为覆盖 TextView 的进度条吗?有什么解决办法吗
根据图库的位置,一个或另一个编辑文本将接收焦点。虽然我可以做到这一点,但行为的画廊崩溃了:当画廊运行一个位置并将焦点设置在编辑文本上时,画廊的速度崩溃。看来 Gallery 速度太慢,无法按时收到请求
调用 Component.requestFocus() 和手动聚焦某个组件(例如,使用键盘或鼠标聚焦)都会触发 FocusEvent.FOCUS_GAINED。 我正在监听 AWT 事件。 我的问题是
我正在尝试以编程方式指定当用户按下键盘上的下一个按钮时焦点所在的位置。我可以让它为某些人工作,但我有一个情况, View 被跳过,它下面的 View 获得焦点。 我进入了调试器,焦点确实经过了我的 V
全新方向 以下是我的问题的 SSCCE。我试图在输入输入时更新字段,在这种情况下,必须失去焦点才能进行更新。 package test; import java.awt.EventQueue; imp
当用户按键盘上的 Enter 键时,我将焦点从一个 AutoCompleteTextView 切换到另一个 AutoCompleteTextView。问题是当下一个 AutoCompleteTextV
接下来我有多个 Edittexts,我在 xml 中添加了 nextFocus 值。 但是根据未成年人复选框值的状态,一个编辑文本是可见的还是不可见的。所以我需要在 YYYY 编辑文本之后动态地关注它
我在控制对焦方面遇到了一些问题。我的接口(interface)定义如下: 来源( radio 组/可选)目的地(编辑文本)数量(编辑文本)转移(按钮) 我正在将“源代码”的可见性更改为我的代码。当我不
我遇到了一个恼人的屏幕问题。屏幕由一堆 Spinner 组成,一个在另一个下,然后在 Spinner 下方,一个 EditText。 问题是当屏幕启动时,EditText 有焦点,这意味着一些 Spi
我有一个 jDialog,其中包含一些需要聚焦的字段。 我看到一些奇怪的行为,有时聚焦会失败,如果您按下 Tab 键,您可以在下面的底层父窗口中看到焦点发生变化,很明显焦点没有转移。 我读了一篇关于聚
解决这个问题花了很多时间,看起来很容易,但我真的很累,找不到解决方案。我有一个 Activity , Activity 有 4 个 EditText 组件,其中 2 个有包含列表的弹出菜单(Alert
我在按下按钮时膨胀 View 。膨胀 View 就像一个对话框,但是当我尝试使用 requestFocus() 将焦点放在对话框上时,requestFocus() 返回 false 意味着我没有将焦点
下面是我为将焦点从一个编辑文本转移到另一个编辑文本而编写的一段代码,但是我在这个实现中遇到的问题是,焦点移动到特定的编辑文本,然后突然移动到下一个编辑文本。所以,我无法输入任何内容,因为焦点根本不在那
想知道 RequestFocus 和 ReqeustFocusFromTouch 之间的实际区别。何时应该使用每种方法,如何使用每种方法,以及每种方法在哪些情况下有用? 举一些例子并详细解释。 最佳答
我有 Action 线程,因为它是 Swing 软件,EDT。 我希望我的程序绘制对话框窗口,当它出现并且充满数据时,我希望将焦点放在选定的文本字段上。 代码流程:当我执行时,它将运行主线程,该线程在
我在 AnchorPane 中嵌入了一个 TextField 以及几个按钮。默认情况下,TextField 没有焦点,因为我希望它显示提示文本(请参阅 prompttext in textfield
我是一名优秀的程序员,十分优秀!