2016-05-31 8 views
0

私はfalseに設定enabled属性と私ののEditTextを持っているので、私は、私が表示されたAndroidのキーボードを得続ける理由を把握する必要があります。私のレイアウトファイルのルート要素は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

+0

(ただし、それはあなたのコードの他の部分に壊れている可能性が常にあります)バギーの行動のように見えます。 android:focusable = "false"で回避策を試しましたか? – sandrstar

+0

いいえ、有効にすると、フォーカス可能な設定をtrueに戻す必要がありますか? –

+0

確かに、それをtrueにして必要に設定する必要があります。有効と同じです。 (アンドロイド:windowSoftInputMode =「stateHidden」)働いていた、と私はマニフェストで私の活動の定義にこの属性を追加し、別の解決策を見つけた[OK]を – sandrstar

答えて

0

あなたの場合ScrollViewでアクティビティを開くたびにアンドロイドキーボードが表示されないようにしたい場合は、android:focusableInTouchMode="true"を配置する必要がありますが、EditTextには配置しないでください。あなたはこのようにScrollViewに入れてする必要があります。

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    tools:context="copsonic.com.SoundExchange.demoApp.FragmentTransmitter"> 


    <!-- Common template for all fragments --> 
    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:paddingBottom="@dimen/activity_vertical_margin" 
     android:paddingLeft="@dimen/activity_horizontal_margin" 
     android:paddingRight="@dimen/activity_horizontal_margin" 
     android:paddingTop="@dimen/activity_vertical_margin" 
     android:focusableInTouchMode="true"> 


     <EditText 
      android:id="@+id/editTextmessage2Send" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_centerHorizontal="true" 
      android:layout_below="@+id/button_send_msg" 
      android:ems="10" 
      android:hint="@string/edit_message" > 

     </EditText> 
    </RelativeLayout> 



</ScrollView> 
関連する問題