一、默认不获取焦点:

在布局文件的父控件中,设置如下属性:

android:focusable="true"
android:focusableInTouchMode="true"

eg:

<LinearLayout
style="@style/FillWrapWidgetStyle"
android:orientation="vertical"
android:background="@color/black"
android:gravity="center_horizontal"
android:focusable="true"
android:focusableInTouchMode="true"
>
<ImageView
android:id="@+id/logo"
style="@style/WrapContentWidgetStyle"
android:background="@drawable/dream_dictionary_logo"
/>
</LinearLayout >

二、光标:

(1)设置光标的位置:

editText.setSelection(2);

输入的参数是个整数

范围为:0~string.lenght();

eg:定位到字符串str的末尾:

editText.setSelection(str.length());

(2)不显示光标:

editText.setCursorVisible(false);

Android EditText技巧总结的更多相关文章

  1. Android EditText悬浮在输入法之上

    Android EditText悬浮在输入法之上 使用 android:windowSoftInputMode="adjustResize" 会让界面整体被顶上去,很多时候我们不需 ...

  2. Android实战技巧:深入解析AsyncTask

    AsyncTask的介绍及基本使用方法 关于AsyncTask的介绍和基本使用方法可以参考官方文档和Android实战技巧:多线程AsyncTask这里就不重复. AsyncTask引发的一个问题 上 ...

  3. Android EditText 不弹出输入法

    当第一次进入一个activity的时候  一般是第一个edittext是默认选中的,但是该死的软键盘也一起弹出来了 那是相当的不美观哈!(#‵′)凸.为此, 本大人就去寻找在刚进入这个activity ...

  4. android EditText获取光标位置并安插字符删除字符

    android EditText获取光标位置并插入字符删除字符1.获取光标位置int index = editText.getSelectionStart(); 2.在光标处插入字符int index ...

  5. Android EditText截获与监听输入事件

      Android EditText截获与监听输入事件共有2种方法: 1.第一种方法:使用setOnKeyListener(),不过这种方式只能监听硬键盘事件. edittext.setOnKeyLi ...

  6. Android EditText不弹出输入法焦点问题的总结

    转自:http://mobile.51cto.com/aprogram-403138.htm 看一个manifest中Activity的配置,如果这个页面有EditText,并且我们想要进入这个页面的 ...

  7. Android EditText属性

    1.EditText输入的文字为密码形式的设置 (1)通过.xml里设置: 把该EditText设为:android:password="true" // 以”.”形式显示文本 ( ...

  8. 解放程序猿宝贵的右手(或者是左手) ——Android自动化测试技巧

    解放双手--Android自动化测试 - eclipse_xu - 博客频道 - CSDN.NET 解放程序猿宝贵的右手(或者是左手) --Android自动化测试技巧

  9. Android EditText自动弹出输入法焦点

    http://mobile.51cto.com/aprogram-403138.htm 1. 看一个manifest中Activity的配置,如果这个页面有EditText,并且我们想要进入这个页面的 ...

随机推荐

  1. python--9、进程池

    concurrent.futures模块 进程池中的进程是固定的,若是池中有任务结束后,等待的任务进来后由空闲的进程来处理. 导入方法三连发: from 标题的模块 import 如下:Process ...

  2. Andorid Scrolling Activity(CoordinatorLayout详情)

    1.new project -> Scrolling Activity 2.Layout xml code activity_scrolling.xml <?xml version=&qu ...

  3. Hive扩展功能(五)--HiveServer2服务高可用

    软件环境: linux系统: CentOS6.7 Hadoop版本: 2.6.5 zookeeper版本: 3.4.8 主机配置: 一共m1, m2, m3这五部机, 每部主机的用户名都为centos ...

  4. codeforces_738D

    D. Sea Battle time limit per test 1 second memory limit per test 256 megabytes input standard input ...

  5. Web 服务器与应用服务器的区别是什么?

    不太严谨的说法:web服务器就是负责接收用户的Request,然后响应html等给客户浏览器.应用服务器处理一些业务逻辑等. 作者:luo链接:https://www.zhihu.com/questi ...

  6. MVC Ajax调用Action时-OnActionExecuting RedirectResult 无法跳转的处理办法

    public class BaseController : Controller { protected override void OnActionExecuting(ActionExecuting ...

  7. MHA的MySQL高可用方案实战

    功能: 1)master的故障切换(keepalived VIP的飘移) 2)主从复制角色的提升和重新转向 其中master 对外提供写服务,备选master2(实际的slave提供读服务,slave ...

  8. 多目标跟踪笔记二:Efficient Algorithms for Finding the K Best Paths Through a Trellis

    Abstract 本文提出了一种新的方法来寻找不相交k最优路径.最坏情况下计算复杂度为N3log(N).该方法比WVD算法(https://www.cnblogs.com/walker-lin/p/1 ...

  9. 【Linq】标准查询操作符

    A.1 聚合 聚合操作符(见表A-1),所有的结果只有一个值而不是一个序列. Average 和 Sum 针对数值 (任何内置数值类型)序列或使用委托从元素值转换为内置数值类型的元素序列. Min 和 ...

  10. php第十四节课

    投票 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.o ...