android各种常用设置

1.设置listview没有分隔线跟滚动条

android:divider="#00000000"
android:scrollbars="none"



2.取消edittext自动获取的焦点

在edittext的父级元素中设置

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

例子:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_height="match_parent"
    android:layout_width="0dp"
    android:layout_weight="1"
    android:orientation="vertical"
    android:background="@drawable/login_layout_shape"
    android:layout_margin="10dp"
    >
    <LinearLayout
        android:layout_height="wrap_content"
    android:layout_width="match_parent"
    android:orientation="vertical"
    android:focusable="true"  
    android:focusableInTouchMode="true"

        >
        <RelativeLayout
            android:layout_height="wrap_content"
       android:layout_width="match_parent"
        >
            <EditText 
       android:layout_height="45dp"
       android:layout_width="match_parent"
       android:layout_margin="10dp"
       android:hint="@string/EmergencyRes_search"
       android:drawableLeft="@drawable/search_drawable"
       android:drawablePadding="25dp"
       android:textSize="18sp"
       android:layout_centerInParent="true"
       android:background="@drawable/search_edittext_shape"/>
            <ImageView 
           android:id="@+id/rs_search_btn"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:src="@drawable/search_icon"
           android:paddingLeft="15dp" 
           android:layout_centerVertical="true"
           />
        </RelativeLayout>
        
        <View 
       android:layout_height="2px"
       android:layout_width="wrap_content"
       android:background="@color/driver_color"
       />
    </LinearLayout>
    
    <LinearLayout 
        android:layout_height="45dp"
        android:layout_width="match_parent"
        android:orientation="horizontal"
        >
        <RelativeLayout 
            android:layout_height="45dp"
            android:layout_width="140dp"
            android:id="@+id/table_1"
            >
            <TextView 
                android:id="@+id/tv_01"
           android:layout_height="wrap_content"
           android:layout_width="wrap_content"
           android:textSize="18sp"
           android:textColor="@color/driver_color"
           android:drawableRight="@drawable/xiala"
           android:text="@string/EmergencyRes_table_1"
           android:layout_centerInParent="true"
            />
        </RelativeLayout>
        
        
        <View 
         android:layout_height="45dp"
         android:layout_width="2px"
         android:background="@color/driver_color"/>
        <RelativeLayout 
            android:layout_height="45dp"
            android:layout_width="140dp"
            android:id="@+id/table_2"
            >
            <TextView 
                android:id="@+id/tv_02"
           android:layout_height="wrap_content"
           android:layout_width="wrap_content"
           android:textSize="18sp"
           android:drawableRight="@drawable/xiala"
           android:textColor="@color/driver_color"
           android:text="@string/EmergencyRes_table_2"
           android:layout_centerInParent="true"/>
        </RelativeLayout>
        <View 
         android:layout_height="45dp"
         android:layout_width="2px"
         android:background="@color/driver_color"/>
        <RelativeLayout 
            android:layout_height="45dp"
            android:layout_width="140dp"
            android:id="@+id/table_3"
            >
            <TextView 
                android:id="@+id/tv_03"
           android:layout_height="wrap_content"
           android:layout_width="wrap_content"
           android:textSize="18sp"
           android:drawableRight="@drawable/xiala"
           android:textColor="@color/driver_color"
           android:text="@string/EmergencyRes_table_3"
           android:layout_centerInParent="true"/>
        </RelativeLayout>
    </LinearLayout>
    <View 
       android:layout_height="2px"
       android:layout_width="wrap_content"
       android:background="@color/driver_color"
       />
    
    
</LinearLayout>

猜你喜欢

转载自blog.csdn.net/ly8261861/article/details/52670326