我在我的布局中添加了一个EditText,并添加了一个提示,并使其水平居中。
在运行应用程序时,提示是不可见的。我发现我应该使椭圆值的TextView是开始:
<EditText
android:id="@+id/number1EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="start"
android:ems="10"
android:gravity="center_horizontal"
android:hint="@string/hint1" />
在Android文档中,我读到:
如果设置,将导致比视图宽度更长的单词
椭圆形的,而不是中间破碎的。
问题是ellipsize在字典里找不到。谁能给我解释一下椭圆大小属性能给我们带来什么好处?开始,结束,中间的区别是什么?
android:ellipsize在API Level 1中添加。省略号是连续三个句号。(…)。
在你的。xml中
<TextView
....
android:text="Hi I am Amiyo, you can see how to ellipse works."
android:ellipsize = "end" />
此时,省略号还不会显示,因为TextView被设置为在输入新文本时自动展开默认值。你需要以某种方式限制TextView。这样做,你可以使用添加到你的TextView一个scrollhorizontal, minLines,或maxLines有省略号显示。
做椭圆:
at the end: this is how it would.
use: android:ellipsize = "end"
And
in the middle:
use: android:ellipsize = "middle"
And
at the start:
use: android:ellipsize = "start"
And
to have no ellipse
use: android:ellipsize = "none"
请注意:
Do not use android:singeLine = "true", it is deprecated.
android:maxLines = "1" will not display the three dots (...)
android:lines = "1" will not display the three dots (...)
欲了解更多详情,请访问这里
android:ellipsize在API Level 1中添加。省略号是连续三个句号。(…)。
在你的。xml中
<TextView
....
android:text="Hi I am Amiyo, you can see how to ellipse works."
android:ellipsize = "end" />
此时,省略号还不会显示,因为TextView被设置为在输入新文本时自动展开默认值。你需要以某种方式限制TextView。这样做,你可以使用添加到你的TextView一个scrollhorizontal, minLines,或maxLines有省略号显示。
做椭圆:
at the end: this is how it would.
use: android:ellipsize = "end"
And
in the middle:
use: android:ellipsize = "middle"
And
at the start:
use: android:ellipsize = "start"
And
to have no ellipse
use: android:ellipsize = "none"
请注意:
Do not use android:singeLine = "true", it is deprecated.
android:maxLines = "1" will not display the three dots (...)
android:lines = "1" will not display the three dots (...)
欲了解更多详情,请访问这里
文本:
This is my first android application and
I am trying to make a funny game,
It seems android is really very easy to play.
假设上面是你的文本,如果你使用ellipsize的start属性,它会像这样
This is my first android application and
...t seems android is really very easy to play.
带有end属性
This is my first android application and
I am trying to make a funny game,...