前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布

杂记

作者头像
夏洛克的猫
发布2018-10-18 14:13:01
4110
发布2018-10-18 14:13:01
举报
文章被收录于专栏:移动开发移动开发

1.EditText自动获取焦点弹出软键盘 为了防止上述情况,可以在其父级控件中添加如下属性:

代码语言:javascript
复制
  android:focusable="true"
  android:focusableInTouchMode="true"
代码语言:javascript
复制
    <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"

代码语言:javascript
复制
 <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"

代码语言:javascript
复制
 <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"

代码语言:javascript
复制
 <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"

代码语言:javascript
复制
 <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,即可消除

代码语言:javascript
复制
   <Button
        android:minHeight="0dp"
        android:minWidth="0dp"
        android:padding="@dimen/spacing_small"
       />

7.打包所有渠道正式的apk包

代码语言:javascript
复制
gradlew assembleRelease

8.特殊符号

代码语言:javascript
复制
&#160;

空格

代码语言:javascript
复制
&#060;

<

代码语言:javascript
复制
&#062;

>

9.各图标大小

代码语言:javascript
复制
mdpi    48px
hdpi    72px
xhdpi   96px
xxhdpi  144px
xxxhdpi 192px

10.TextView超过一行自动省略

maxLinesellipsize结合使用即可

代码语言:javascript
复制
<TextView
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:maxLines="1"
  android:ellipsize="end"/>

11.获取矢量图的 Drawable

代码语言:javascript
复制
 AppCompatResources.getDrawable(context,R.drawable.img_vector)

不要使用

代码语言:javascript
复制
ContextCompat.getDrawable()

这个方法会在某些系统版本上出现异常

12.查看该类的所有签名

代码语言:javascript
复制
javap -s -p class文件路径
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2016年03月18日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档