避免 textField 获得焦点 - Android
Avoid textField get focus - Android
有没有办法避免在 windows 加载时 textField 获得焦点?
我的 tiapp.xml
里有这个
<android xmlns:android="http://schemas.android.com/apk/res/android">
<manifest android:versionCode="1" android:versionName="0.0.1" android:windowSoftInputMode="stateHidden">
<application android:theme="@style/Theme.CustomActionBar"/>
<uses-sdk android:maxSdkVersion="23"
android:minSdkVersion="14" android:targetSdkVersion="23"/>
</manifest>
</android>
android:windowSoftInputMode 应该可以完成工作,但什么也没发生。
提前致谢..
我认为 android:windowSoftInputMode="stateHidden|adjustResize"
会成功。
只需像这样在清单文件中定义您的 Activity。
<activity
android:name="packagename.classname"
android:label="@string/app_name"
android:windowSoftInputMode="stateHidden|adjustResize" >
</activity>
编码愉快。
解决此问题的一种可能方法是将以下布局添加到您的 XML:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="0px"
android:layout_height="0px"
android:focusable="true"
android:focusableInTouchMode="true"/>
<AutoCompleteTextView
android:id="@+id/autotext"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:nextFocusLeft="@id/autotext"
android:nextFocusUp="@id/autotext"/>
</LinearLayout>
通过 dooing,您的焦点将转移到一个不可见的组件上。您可以创建一个布局并将其包含在您的主要内容中 XML 使其更具可读性。
试试这个模块:
https://github.com/mpociot/TiAndroidAutofocus
................................................ .........
有没有办法避免在 windows 加载时 textField 获得焦点? 我的 tiapp.xml
里有这个 <android xmlns:android="http://schemas.android.com/apk/res/android">
<manifest android:versionCode="1" android:versionName="0.0.1" android:windowSoftInputMode="stateHidden">
<application android:theme="@style/Theme.CustomActionBar"/>
<uses-sdk android:maxSdkVersion="23"
android:minSdkVersion="14" android:targetSdkVersion="23"/>
</manifest>
</android>
android:windowSoftInputMode 应该可以完成工作,但什么也没发生。 提前致谢..
我认为 android:windowSoftInputMode="stateHidden|adjustResize"
会成功。
只需像这样在清单文件中定义您的 Activity。
<activity
android:name="packagename.classname"
android:label="@string/app_name"
android:windowSoftInputMode="stateHidden|adjustResize" >
</activity>
编码愉快。
解决此问题的一种可能方法是将以下布局添加到您的 XML:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="0px"
android:layout_height="0px"
android:focusable="true"
android:focusableInTouchMode="true"/>
<AutoCompleteTextView
android:id="@+id/autotext"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:nextFocusLeft="@id/autotext"
android:nextFocusUp="@id/autotext"/>
</LinearLayout>
通过 dooing,您的焦点将转移到一个不可见的组件上。您可以创建一个布局并将其包含在您的主要内容中 XML 使其更具可读性。
试试这个模块:
https://github.com/mpociot/TiAndroidAutofocus
................................................ .........