Edittext光标指针不在视图范围内

时间:2012-12-17 05:03:48

标签: android

我使用了一个Edittext,其“maxlines”设置为1.当我输入一些大文本时,文本的某一部分是不可见的。所以我使用光标指针(在edittext上单击时出现的蓝色)来滚动文本。但是当我尝试使用它时,它超出了视图,而不是显示隐藏的文本。

我有什么遗失的吗?

3 个答案:

答案 0 :(得分:1)

设置Edittext的属性,它将解决您的问题。

android:singleLine="true"
android:ellipsize="end"

答案 1 :(得分:0)

http://developer.android.com/reference/android/widget/EditText.html说明以下内容

        android:maxLength   
        setFilters(InputFilter) 
        Set an input filter to constrain the text length to the specified number. 

您可以使用它来指定EditText输入的长度

或者您希望文本比视图宽,然后您可以使用

        android:scrollHorizontally  
        setHorizontallyScrolling(boolean)   
        Whether the text is allowed to be wider than the view (and therefore can be scrolled horizontally). 

答案 2 :(得分:0)

不确定您的意思,我的回答是基于我对您的问题的理解:

尝试在XML中使用以下代码行:

    android:paddingRight="08dp" 
    android:paddingLeft="08dp"