2016-12-03 11 views
0

この資料の内容に設定されているが、私は 活動:iconifiedByDefault属性がfalse

2.この

<?xml version="1.0" encoding="utf-8"?> 
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:id="@+id/activity_contacts" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_margin="0dp" 
    android:padding="0dp" 
    tools:context="com.example.hangout1.contacts"> 

     <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:orientation="vertical" 
     android:padding="0dp" 
     android:layout_margin="0dp"> 

      <SearchView 
       android:id="@+id/searchView" 
       android:layout_width="match_parent" 
       android:layout_height="60dp" 
       android:queryHint="Enter a name or number" 
       android:iconifiedByDefault="true" 
       android:inputType="text" 
       /> 
     </LinearLayout> 

</FrameLayout> 
を呼んでいる活動があるさ私はそれをどのように呼んでいるのですか

public void loadContacts(View view){ 
    Intent intent = new Intent(GroupMembersActivity.this,contacts.class); 
    startActivity(intent); 
} 

私はアンドロイドを新しくしました。属性 'iconifiedByDefault'が 'true'に設定されていて、検索アイコンに触れていない場合(展開していない場合)、戻るボタンを1回押すと前のアクティビティ(このアクティビティと呼ばれるアクティビティ)に戻ります。しかし、「false」に設定されている場合、前のアクティビティに戻るには、戻るボタンで2回タッチします。この行動に関する少しの洞察を教えてください。

答えて

0

searchviewは、デフォルトではfocusable = trueに設定されています。これは、検索ビューのクエリ領域がアクティブであることを意味し、テキスト入力の準備ができています。フォーカスを終了するにはワンタッチで戻り、アクティビティを取り戻すには1つのタッチが必要でした。属性focusableをfalseに設定すると、クエリ領域は準備ができておらず、タッチされたときだけ準備が整います。 1タップ少ない。ここで私は何をしたのですか

android:focusable="false"