2013年4月30日火曜日

起動後、EditTextにフォーカスがあたってキーボードが出るのを防ぐ

起動後や、ダイアログ表示後に、いきなりキーボードが表示されるのを防ぐには、別のViewにフォーカスを映す。

例えば、TextViewにフォーカスを移してしまう。


    <TextView
   android:layout_width="300dp"
   android:layout_height="30dp"
   android:text="STB MAC Address"
   android:textSize="25dp"
   android:layout_margin="3dp"
        android:layout_marginLeft = "10dp"
        android:focusable="true" 
           android:focusableInTouchMode="true"  >
     <requestFocus /> 
     </TextView>

上の例のように

 android:focusable="true"
 android:focusableInTouchMode="true"
 <requestFocus />
の3行を入れる。


0 件のコメント:

コメントを投稿