我有一个Activity3 EditText秒和一个自定义视图,它作用一个专门的键盘来添加信息到EditTexts.
目前我正在将Activity视图传递给视图,以便我可以获得当前聚焦的编辑文本并更新自定义键盘中的内容.
有没有一种方法可以引用父活动并在EditText不将活动传递到视图的情况下获得当前的焦点?
我的应用程序使用键盘控制和左右移动时,我注意到,偶尔你会得到什么,我会称其为"神秘视图" -我这样说是因为没有看到似乎被选中,但没有任何可见的或者集中
有什么方法可以找出我在任何特定时间关注的内容吗?例如.触发视图选择等的监听器
谢谢
**编辑 - ntc的一些代码**
LinearLayout col1 = (LinearLayout)findViewById(R.id.col1);
Button btn = new Button(this);
btn.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
LinearLayout col1 = (LinearLayout)findViewById(R.id.col1);
if(col1.getFocusedChild() != null) {
Log.d(TAG, col1.getFocusedChild().toString());
}
}
});
col1.addChild(btn);
Run Code Online (Sandbox Code Playgroud) 我有一个使用DetailsOverviewRow和FullWidthDetailsOverviewRowPresenter的详细信息片段.当页面首次加载时,操作按钮被选中.当我按下一次时,焦点离开按钮,没有其他任何事情发生.当我再次按下时,焦点移动到页面下方的ListRow.我试图弄清楚为什么在演示者,部分中调用的概述或正文不会集中.
概述/正文可读的两个屏幕截图之间是否应该有第二个"状态"?
可能值得注意.DetailsFragment未在活动xml中声明,我正在使用FragmentTransactions手动更改片段.此外,Fragment使用静态create方法实例化(下面的源代码).
提前致谢.
我有两个碎片,上面有几个EditText框.它们都是相似的,但是非常奇怪的是,1将在EditText字段之间切换,但另一个不会.
这是我遇到的问题:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/loginparent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ff008DFF" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dip"
android:background="#ff008DFF"
android:orientation="vertical" >
<ImageView
android:id="@+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="40dip"
android:contentDescription="@string/logoDesc"
android:src="@drawable/logo1" />
<EditText
android:id="@+id/usernameLog"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:focusable="true"
android:focusableInTouchMode="true"
android:hint="@string/username"
android:imeOptions="actionNext"
android:singleLine="true"
android:textSize="14sp" />
<EditText
android:id="@+id/passwordLog"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/password"
android:imeOptions="actionDone"
android:inputType="textPassword"
android:singleLine="true"
android:textSize="14sp" />
<Button
android:id="@+id/loginButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/login" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dip" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusable="false"
android:focusableInTouchMode="false"
android:text="@string/newuser"
android:textColor="#ffffffff"
android:textSize="14sp" />
<Button
android:id="@+id/viewSignupBtn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/signup" />
</LinearLayout>
</LinearLayout>
<ProgressBar
android:id="@+id/progressBarLog"
style="?android:attr/progressBarStyleLarge" …Run Code Online (Sandbox Code Playgroud)