Android 按钮小部件连字符
Android Button widget hyphenation
我的项目有问题。我使用 android.widget.Button
。当单词不能放在 Button
中的一行时,它会像这样剪切:Somelon>gword(其中 '>'是新行)。如何解决?以及如何为文本创建内部填充,因为长单词触及按钮的边框?
尝试将 属性 android:singleLine="true"
和 android:padding="10dp"
用于您的按钮小部件。
您可以试试下面的代码。其中 paddingRight
和 paddingLeft
在右侧和左侧保持 25dp 的填充。如果你想在一个 line.Then 上发短信
你可以使用 android:singleLine="true"
<Button
android:id="@+id/she_was_good"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="25dp"
android:paddingLeft="25dp"
android:ellipsize=”marquee”
android:text="@string/im_sorry_lol_str" />
读这个post
我的项目有问题。我使用 android.widget.Button
。当单词不能放在 Button
中的一行时,它会像这样剪切:Somelon>gword(其中 '>'是新行)。如何解决?以及如何为文本创建内部填充,因为长单词触及按钮的边框?
尝试将 属性 android:singleLine="true"
和 android:padding="10dp"
用于您的按钮小部件。
您可以试试下面的代码。其中 paddingRight
和 paddingLeft
在右侧和左侧保持 25dp 的填充。如果你想在一个 line.Then 上发短信
你可以使用 android:singleLine="true"
<Button
android:id="@+id/she_was_good"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="25dp"
android:paddingLeft="25dp"
android:ellipsize=”marquee”
android:text="@string/im_sorry_lol_str" />
读这个post