在EditText上的光标控制 [英] Cursor control in EditText

查看:144
本文介绍了在EditText上的光标控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,这是要我发疯。我还是一个新手(也许是白痴),但是这其中有把我手忙脚乱。

Ok, this is about to drive me nuts. I'm still a newbie (and maybe an idiot) but this one has had me running in circles.

我想实现通过软按钮(左,右,向上或向下)的EDITTEXT光标控制。从我的研究,它看起来像我需要像为moveUp(),moveLeft(),extendUp(Selection对象的方法)等,但它们都需要一个text.layout对象,我不知道如何得到一个。

I'm trying to implement cursor control in an editText via soft buttons (left, right, up down). From what I've researched, it looks like I need the methods in the Selection object like moveUp(), moveLeft(), extendUp() etc. but they all need a "text.layout" object and I don't know how to get one.

我在正确的轨道上吗?帮助?

Am I on the right track? Help?

推荐答案

这听起来像你想使用的 DynamicLayout 对象。 (它的 text.Layout 派生类中的一个,另外一个是< A HREF =htt​​p://developer.android.com/reference/android/text/StaticLayout.html相对=nofollow> StaticLayout 。)

It sounds like you want to use a DynamicLayout object. (It's one of the derived classes of text.Layout, another being StaticLayout.)

这篇关于在EditText上的光标控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆