2017-05-10 12 views
0

の内側に私はinsideLinearLayoutあるTextInputLayoutに包まれEditTextを持っていると私はLinearLayouttouchedときfragmentを示したいと思います。しかしEditTexttouchを傍受しています。メイキングビューのクリック可能な、ないEDITTEXTビュー

私はEditTextTextInputLayoutfocusable="false"clickable="false"を設定しようとしたが、今touchは少しのヒントcolor slightlyを変更を除いて何もしません。

enabled="false"は灰色で表示されないため、style colorが変更されていません。

私のxml:今の

<LinearLayout 
      android:id="@+id/type_layout" 
      android:orientation="vertical" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 

      <android.support.design.widget.TextInputLayout 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginBottom="10dp" 
       android:id="@+id/type_input_layout" 
       android:clickable="false" 
       android:focusable="false"> 

       <EditText 
        android:id="@+id/type_input" 
        android:hint="Type" 
        android:text="Public" 
        android:clickable="false" 
        android:focusable="false" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:inputType="textNoSuggestions|textMultiLine" 
        android:background="@color/transparent" 
        android:gravity="left" 
        android:textSize="22sp"/> 

      </android.support.design.widget.TextInputLayout> 

     </LinearLayout> 

私のソリューション:ただのEditText

答えて

0

の上にビューを置くにはandroid:enabled="false"を試してみてください。私はよくわからないが、うまくいくかもしれない。

+1

それは、それも灰色ではありません私が望んでいないすべてのもの – nic

0

LinearLayoutでandroid:descendantFocusability="blocksDescendants"を使用してみてください。子どもが見ることができないようにすることはできません。

はのLinearLayoutのすべての子ビューにandroid:duplicateParentState="true"をお試しください:

また

android:focusable="false" 
android:focusableInTouchMode="false" 

EDITフォーカス可能な特性の両方を使用して試すことができます。 this questionもご覧ください。 EditTextのinputTypeがクリックを傍受することができると言及している人がいます。

+0

ありがとう、何もここに何も変えていないようだが – nic

+0

EditTextはまだフォーカス可能ですか? –

+0

edittextはフォーカスできませんが、引き続きLinearLayoutのonClickを取得できません – nic

0

この2行TextInputlayoutから

android:clickable="false" 
android:focusable="false" 

を削除し、あなたのEDITTEXTであなたのリニアレイアウト

android:clickable="true" 

セットでその作業

セットをすることができ、これを試してみてください

android:clickable="false" 
android:focusable="false" 
関連する問題