如何让EditText不自动获取焦点和取消编辑框颜色

来源:互联网 发布:比目鱼游戏工作室知乎 编辑:程序博客网 时间:2024/05/27 10:43


一.EditText不自动获取焦点

解决之道:在EditText的父级控件中找一个,设置成

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

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


<LinearLayout
             android:layout_width="fill_parent"
             android:layout_height="wrap_content"
             android:orientation="vertical"
             android:focusable="true"

       android:focusableInTouchMode="true" >
              <RelativeLayout
               android:layout_width="fill_parent"
               android:layout_height="wrap_content"
               android:layout_marginTop="14dp"
               android:gravity="center_vertical"
               android:clickable="true"
               android:background="@drawable/preference_first_item" >
               <EditText
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:padding="8dp"
             android:hint="输入驾驶证号"
             android:textSize="17sp"  
       android:textColor="#000"
       android:background="@null"
       />
                         
          </RelativeLayout>


二.取消编辑框颜色:

设置背景为:

android:background="@null"



0 0
原创粉丝点击