0

edittextをタッチすると警告ダイアログを表示する方法を教えてください。 私はすでにonFocusChange()とOnClick()で試していましたが、期待どおりに正しく動作していなかったので、私も親切に助けてくれるコードをいくつか入れました。edittextでアラートダイアログを表示する方法

ed2.setOnFocusChangeListener(new View.OnFocusChangeListener() { 
      @Override 
      public void onFocusChange(View v, boolean hasFocus) { 
       if(hasFocus) 
       { 
         getActivity().runOnUiThread(new Runnable() { 
          @Override 
          public void run() { 
           hideSoftKeyboard(btn_set_no); 
           showAlert(); 
          } 
         }); 
        } 
       } 
      } 
     }) 

;

+0

.kindly動作していないことのEditText – Saveen

+0

にonclickの焦点偽とシンプルにそれを作るチェックすることは、私を助けて –

+0

うん確かに私にあなたがあなたの問題を解決したのは数分 – Saveen

答えて

0

こんにちは、これを試してみてください。android:focusable = "false"あなたのedittextにして、それを簡単にクリックしてください。これは

<EditText 
    android:id="@+id/ethome_click" 
    android:layout_width="match_parent" 
    android:layout_height="@dimen/margin_40" 
    android:drawableLeft="@drawable/profile_ic" 
    android:drawablePadding="@dimen/margin_10" 
    android:hint="@string/search_source" 
    android:padding="@dimen/margin_5" 
    android:focusable="false" 
    android:singleLine="true" 
    android:textSize="@dimen/text_size_14" 
    android:theme="@style/Theme.App.Base" /> 



@BindView(R.id.ethome_click) 
EditText ethome_click; 


@OnClick({R.id.ethome_click}) 
public void OnClick(View view) { 

    switch (view.getId()) { 
     case R.id.ethome_click: 

      showAlert(); 

      break; 

    } 
} 
関連する問題