android 如何让 EditText 默认不获取焦点

解决办法:给EditText的父级控件,设置成

   android:focusable="true"  
   android:focusableInTouchMode="true"

这样,就把EditText默认的行为截断了!

 

<LinearLayout 
        style="@style/FillWrapWidgetStyle"
        android:orientation="vertical"
        android:background="@color/black"
        android:gravity="center_horizontal"
        android:focusable="true"  
        android:focusableInTouchMode="true"
        >
        <ImageView
            android:id="@+id/logo"
            style="@style/WrapContentWidgetStyle"
            android:background="@drawable/dream_dictionary_logo"
          />
        <RelativeLayout 
            style="@style/FillWrapWidgetStyle"
            android:background="@drawable/searchbar_bg"
            android:gravity="center_vertical"
            >
            <EditText
                android:id="@+id/searchEditText"
               style="@style/WrapContentWidgetStyle"
               android:background="@null"
               android:hint="Search"
               android:layout_marginLeft="40dp"
               android:singleLine="true"
             />
            
        </RelativeLayout>
        
    </LinearLayout>


 

你可能感兴趣的:(android,EditText,焦点)