Android小知识点总结

1.AppIcon切图尺寸

drawable-xhdpi—-96 96
drawable-mdpi—–48
48
drawable-ldpi—–36 36
drawable-hdpi—–72
72

2.横竖屏切换想要不重新执行生命周期需配置

android:configChanges=”orientation|keyboardHidden|screenSize”
配置后只会执行onConfigurationChanged方法。

3.ListView子条目上有按钮优先级问题

可以在子布局根目录,也就是Item布局的根目录添加以下属性
android:descendantFocusability=”blocksDescendants”

4.ScrollView中套用ListView时直接跳转到ListView记录第一条位置

可以在父布局元素下添加以下属性
android:focusable="true"android:focusableInTouchMode="true"

5.页面背景变成黑色

尝试修改主题为
android:theme=”@android:style/Theme.Light.NoTitleBar”

6.弹出软键盘修改右下角按钮

imeOptions一共有4个属性值:

  1. actionUnspecified 未指定,对应常量EditorInfo.IME_ACTION_UNSPECIFIED.

  2. actionNone 没有动作,对应常量EditorInfo.IME_ACTION_NONE

  3. actionGo 去往,对应常量EditorInfo.IME_ACTION_GO

  4. actionSearch 搜索,对应常量EditorInfo.IME_ACTION_SEARCH

  5. actionSend 发送,对应常量EditorInfo.IME_ACTION_SEND

  6. actionNext 下一个,对应常量EditorInfo.IME_ACTION_NEXT

  7. actionDone 完成,对应常量EditorInfo.IME_ACTION_DONE

android:imeOptions="actionSearch" android:singleLine="true"


然后添加点击事件

  
  
view.setOnEditorActionListener(new OnEditorActionListener() {
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
// 点击搜索后隐藏键盘`
((InputMethodManager) title_searck.getContext()
.getSystemService(Context.INPUT_METHOD_SERVICE))
.hideSoftInputFromWindow(getCurrentFocus()
.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
return true;
}
return false;
}
});

7.在String.xml中添加空格时用以下方式

 (后面的分号要带)






  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值