android各種常用設定
阿新 • • 發佈:2018-11-08
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:orientation="vertical"
android:focusable="true"
android:focusableInTouchMode="true"
>
<RelativeLayout
android:layout_height="wrap_content"
>
<EditText
android:layout_height="45dp"
android:layout_width="match_parent"
android:layout_margin="10dp"
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>