Android EditText无法获得焦点
我正在使用带有自定义标题的TabActivityAndroid EditText无法获得焦点,android,focus,xamarin.android,android-tabactivity,custom-titlebar,Android,Focus,Xamarin.android,Android Tabactivity,Custom Titlebar,我正在使用带有自定义标题的TabActivity TabControl.xml包含 android:focusable="true" android:focusableInTouchMode="true" 启动活动时,默认选项卡为Tab0 在Tab0的.xml中: android:focusable="true" android:focusableInTouchMode="true" 而对于自定义标题栏,TitleBar.xml包含: <RelativeLayout //n
TabControl.xml
包含
android:focusable="true"
android:focusableInTouchMode="true"
启动活动时,默认选项卡为Tab0 在Tab0的.xml中:
android:focusable="true"
android:focusableInTouchMode="true"
而对于自定义标题栏,
TitleBar.xml
包含:
<RelativeLayout
//not setting android:focusable here >
<EditText
android:id="@+id/edsearch"
android:focusable="true"
android:focusableInTouchMode="true"
android:nextFocusUp="@id/edsearch"
android:nextFocusLeft="@id/edsearch" >
但问题是,当我尝试在
标题栏
的编辑文本
中输入任何输入时,它都不起作用。这背后的原因可能是EditText
没有焦点
为了纠正它,我按照建议使用了:nextFocusUp
和:nextFocusUp
但它仍然不起作用
我已经为EditText使用了OnClick事件,单击它就会触发它
但TextChanged事件不会执行,因为我无法向EditText提供任何输入
由于我是Mono Android新手,非常感谢您的帮助。删除
android:focusable="true"
android:focusableInTouchMode="true"
从选项卡活动
不需要设置
android:focusable="true"
android:focusableInTouchMode="true"
android:nextFocusUp="@id/edsearch"
android:nextFocusLeft="@id/edsearch"