1.EditText不显示光标

 开发的时候遇到有部分手机,小米系列以及华为部分手机不显示光标。

 设置EditText属性 

    android:textCursorDrawable="@null"
android:cursorVisible="true"

 可参考,http://stackoverflow.com/questions/15093758/edittext-cursor-is-invisible-in-android-4-0第一个回答。

 附上我自己封装的一个方法

 

 private final static String TAG = "EditTextCompat";

     /**
* 设置光标可见 <br/>
* 此处为了解决部分手机(如小米、华为)无法显示光标的问题,由于编译环境为2.3,导致部分函数无法调用,此处使用反射调用<br/>
*/
public static void setCursorVisible(EditText editText, Context context) {
editText.setCursorVisible(true);
// sdk
// 对应关系表,见http://developer.android.com/guide/topics/manifest/uses-sdk-element.html
if (android.os.Build.VERSION.SDK_INT >= 12) {// Android 3.1.x API12
// HONEYCOMB_MR1
String filedNameString = "mCursorDrawableRes";
// mCursorDrawableRes
Class<? extends EditText> editTextClass = editText.getClass();
Class<? extends TextView> textViewClass = null;
if (editTextClass != null) {
textViewClass = (Class<? extends TextView>) editTextClass
.getSuperclass();
}
if (textViewClass != null) {
Field mCursorDrawableField = null;
try {
mCursorDrawableField = textViewClass
.getDeclaredField(filedNameString);
} catch (NoSuchFieldException e) {
// TODO Auto-generated catch block
Log.i(TAG, "NoSuchFieldException");
e.printStackTrace();
}
if (mCursorDrawableField != null) {
mCursorDrawableField.setAccessible(true);
try {
mCursorDrawableField.set(editText, 0); } catch (IllegalArgumentException e) {
Log.i(TAG, "IllegalArgumentException");
e.printStackTrace();
} catch (NotFoundException e) {
Log.i(TAG, "NotFoundException");
e.printStackTrace();
} catch (IllegalAccessException e) {
Log.i(TAG, "IllegalAccessException");
e.printStackTrace();
}
} }
}
}
}

 2.AutoCompleteTextView在部分手机(如联想a860e)显示黑条。

  见图

  

  解决方案:在themes.xml设置一个主题,设置它的android:dropDownListViewStyle属性。

  <style name="search_theme" parent="android:style/Theme.NoTitleBar">
<item name="android:dropDownListViewStyle">@style/widget_dropdownlistview</item>
</style>

  在styles.xml中定义下面字段。

   <style name="widget_dropdownlistview" parent="android:style/Widget.Holo.ListView.DropDown">
<item name="android:scrollbars">none</item>
<item name="android:divider">@color/white</item>
</style>

  对需要用到AutoCompleteTextView的Activity设置主题(AndroidManifest.xml中设置)。

  然后样式就OK了。

  如图

  

可参考http://www.apkbus.com/android-126131-1-1.html

3.Dialog在部分手机上显示黑条

  设置

  

  <item name="android:windowContentOverlay">@null</item>

  可参考。http://www.cnblogs.com/kaima/archive/2011/07/29/2121457.html

【Android】Android部分问题记录的更多相关文章

  1. android布局常用属性记录

    android布局常用属性记录   http://blog.csdn.net/xn4545945/article/details/7717086这里有一部分别人总结的其余的: align:对齐 par ...

  2. android studio 使用问题记录

    android studio 使用问题记录 下载地址:FQ或园子内好心人提供的国内地址: http://www.cnblogs.com/bjzhanghao/archive/2012/11/14/an ...

  3. Android中的路径记录

    Android中的路径记录 | RobinBlog 导航 导航 博客 分类 标签 友链 关于 搜索 Environment.getDataDirectory().getPath()=/dataEnvi ...

  4. Android遇到的错误记录

    解决小米手机无法收到开机广播的问题 http://blog.csdn.net/ksr12333/article/details/16116627 怎样在Android Studio中打开DDMS窗口? ...

  5. Android 手机影音 开发过程记录(六)

    前一篇已经将音乐播放及切换的相关逻辑弄好了,今天主要理一下剩余的部分,包含: 1. 自己定义通知栏的布局及逻辑处理 2. 滚动歌词的绘制 3. 歌词解析 效果图 通知栏 自己定义布局: <?xm ...

  6. Android Adapter的一些记录

    一.摘要 An Adapter object acts as a bridge between an AdapterView and the underlying data for that view ...

  7. 图解Android - Android GUI 系统 (1) - 概论

    Android的GUI系统是Android最重要也最复杂的系统之一.它包括以下部分: 窗口和图形系统 - Window and View Manager System. 显示合成系统 - Surfac ...

  8. Android] Android XML解析学习——方式比较

     [Android] Android XML解析学习——方式比较 (ZT)  分类: 嵌入式 (From:http://blog.csdn.net/ichliebephone/article/deta ...

  9. Stack Overflow 排错翻译 - Closing AlertDialog.Builder in Android -Android环境中关闭AlertDialog.Builder

    Stack Overflow 排错翻译  - Closing AlertDialog.Builder in Android -Android环境中关闭AlertDialog.Builder 转自:ht ...

  10. [Android]Android端ORM框架——RapidORM(v2.1)

    以下内容为原创,欢迎转载,转载请注明 来自天天博客:http://www.cnblogs.com/tiantianbyconan/p/6020412.html [Android]Android端ORM ...

随机推荐

  1. centos coreseek 快速安装

    CoreSeek快速安装: 安装前,建议查看:源码包说明README:4.0/4.1版可参考3.2版本安装,步骤相同:如遇到问题,请看详细安装说明. ##下载coreseek:coreseek 3.2 ...

  2. Linux负载均衡概念与实践(二)

    构建实践LVS+Keepalived实现负载均衡 keepalived概述 1.keepalived是专门针对LVS设计的一款强大的辅助工具,主要用来提供故障切换和健康检查功能——判断LVS负载调度器 ...

  3. html5绘制折线图

    html5绘制折线图详细代码 <html> <canvas id="a_canvas" width="1000" height="7 ...

  4. JS判断输入框值是否为空

    <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...

  5. CentOS 6.5升级Python后yum不可用的解决方案

    因开发需要,今天把CentOS 6.5自带的Python2.6.6升级到了Python2.7.3.按照如下步骤进行升级 1.查看当前系统python的版本 python -V 2.下载2.7.3版本的 ...

  6. [转]利用/*+Ordered*/提高查询性能

    [转]利用/*+Ordered*/提高查询性能 2009-02-06 10:46:27|  分类: Oracle |  标签: |字号大中小 订阅  消耗在准备利用Oracle执行计划机制提高查询性能 ...

  7. Word分栏

    情景描述 Word分栏在小论文的撰写过程中是很常用的技术.但是,我们经常会遇到很难过的情况: 一段文字本来是连续分布的,可是当选择了分两栏         之后,开始部分在左边一栏,中间在右边一栏. ...

  8. BZOJ 3990 [SDOI 2015] 排序 解题报告

    这个题哎呀...细节超级多... 首先,我猜了一个结论.如果有一种排序方案是可行的,假设这个方案是 $S$ . 那么我们把 $S$ 给任意重新排列之后,也必然可以构造出一组合法方案来. 于是我们就可以 ...

  9. Ubuntu下使用ap-hotspot出现“Another process is already running"问题的解决方案

    参考Problem with ap-hotspot 问题描述: This is the message displayed in my terminal screen when I typed sud ...

  10. Lua 笔记

    lua命令: #enter shell lua #excute script file lua xxx.lua lua脚本: #!/usr/local/bin/lua 核心概念: As a exten ...