0
我需要弄清楚为什么我一直在显示android键盘,因为我的EditText的enabled属性设置为false。我的布局文件的根元素是ScrollView。当我取出ScrollView元素时,它可以与LinearLayout之类的根元素完美协作。禁用EditText元素显示键盘
这是ScrollView的预期行为,还是只是一个错误的东西? (我没有理解ScrollView具有文本可编辑元素行为,如果是这种情况)。
只是作为一个额外的,我的一些布局代码......
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true"
android:scrollbarStyle="insideInset"
android:scrollbars="vertical"
>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="8dp"
android:paddingBottom="8dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Lorem ipsum dolor sit amet"
android:layout_marginBottom="20dp"
/>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginBottom="20dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/input_name_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_idcard_icon"
/>
<EditText
android:id="@+id/personal_setting_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/input_name_icon"
android:enabled="false"
android:text="First Name" />
不要强调出来,我会改变我的字符串和尺寸正确...; d
看起来像越野车的行为(但是,总有可能性,它在你的代码的其他部分损坏)。你有没有尝试解决android:focusable =“false”? – sandrstar
不,但是,启用后是否需要将可聚焦设置恢复为真? –
当然,您确实需要将其设置为true,然后才需要。与启用相同。 – sandrstar