1.EditText自动获取焦点弹出软键盘 为了防止上述情况,可以在其父级控件中添加如下属性:
android:focusable="true"
android:focusableInTouchMode="true"
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusable="true"
android:focusableInTouchMode="true"
>
2.ListView不显示滚动条 添加下面的属性: android:scrollbars="none"
<ListView
android:id="@+id/order_list_show"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="@dimen/spacing_normal"
android:scrollbars="none" />
3.ListView不显示分割线
做如下配置 android:divider="@null"
<ListView
android:id="@+id/order_list_show"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="@dimen/spacing_normal"
android:divider="@null" />
4.TextView多行文字的间距 添加如下属性 android:lineSpacingExtra="@dimen/spacing_normal"
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lineSpacingExtra="@dimen/spacing_normal"
android:padding="@dimen/spacing_normal"
android:textColor="@color/black"
android:textSize="@dimen/font_normal" />
5.EditText修改hint的字体颜色 添加如下属性 android:textColorHint="@color/deep_gray"
<EditText
android:id="@+id/destination"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColorHint="@color/deep_gray" />
6.除去Button默认的padding 其实button是默认设置了 android:minHeight,android:minWidth属性 在属性中设置为0,即可消除
<Button
android:minHeight="0dp"
android:minWidth="0dp"
android:padding="@dimen/spacing_small"
/>
7.打包所有渠道正式的apk包
gradlew assembleRelease
8.特殊符号
 
空格
<
<
>
>
9.各图标大小
mdpi 48px
hdpi 72px
xhdpi 96px
xxhdpi 144px
xxxhdpi 192px
10.TextView超过一行自动省略
maxLines和ellipsize结合使用即可
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:maxLines="1"
android:ellipsize="end"/>
11.获取矢量图的 Drawable
AppCompatResources.getDrawable(context,R.drawable.img_vector)
不要使用
ContextCompat.getDrawable()
这个方法会在某些系统版本上出现异常
12.查看该类的所有签名
javap -s -p class文件路径