前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Android常见问题剖析

Android常见问题剖析

作者头像
先知先觉
发布2019-01-21 11:21:55
3550
发布2019-01-21 11:21:55
举报

一、 Edittext编辑完成后让键盘的“完成”变成“搜索”样式

1.先设置属性Android:singleline =“true”

2.再设置Android:imeOptions=“actionSearch”

二、 ArrayList去除重复数据

private ArrayList singleElement(ArrayList dateCount) {
        ArrayList newAl = new ArrayList();

        for(Iterator it = dateCount.iterator(); it.hasNext();)
        {
            Object obj = it.next();
            if(!newAl.contains(obj))
            {
                newAl.add(obj);
            }
        }
        return newAl;
    }

三、给shape设置背景颜色

GradientDrawable background=(GradientDrawable)iv_test_background_changge.getBackground();
background.setColor(getResources().getColor(R.color.colorPrimaryDark));

四、Adb 截图

 第一步:现将图片截图下来
 adb shell screencap -p /sdcard/screen.png   
 第二步:再将图片复制到电脑上
 adb pull /sdcard/screen.png 

五、安卓执行DOS命令

Runtime.getRuntime().exec("inputkeyevent20");
执行exec中的String命令

六、获得 LayoutInflater 实例的三种方式:

//调用Activity的getLayoutInflater()
1.LayoutInflater inflater = getLayoutInflater(); 

2.LayoutInflater localinflater =(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

3. LayoutInflater inflater = LayoutInflater.from(context);  
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2016年08月04日,如有侵权请联系 cloudcommunity@tencent.com 删除

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

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

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

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 一、 Edittext编辑完成后让键盘的“完成”变成“搜索”样式
  • 二、 ArrayList去除重复数据
  • 三、给shape设置背景颜色
  • 四、Adb 截图
  • 五、安卓执行DOS命令
  • 六、获得 LayoutInflater 实例的三种方式:
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档