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