100字范文,内容丰富有趣,生活中的好帮手!
100字范文 > Android设置Button字母大小写

Android设置Button字母大小写

时间:2023-08-19 02:16:56

相关推荐

Android设置Button字母大小写

在Button中显示的英文字母默认是全部大写的

<Buttonandroid:id="@+id/textview"android:layout_width="match_parent"android:layout_height="wrap_content"android:gravity="center"android:text="I'm Capital" />

下面介绍两种简单的设置原本大小写的方法:

xml中设置**(android:textAllCaps=“false”)**

<Buttonandroid:id="@+id/textview"android:layout_width="match_parent"android:layout_height="wrap_content"android:gravity="center"android:text="I'm Capital"android:textAllCaps="false" />

代码中设置**(setAllCaps(false))**

textView = (Button) findViewById(R.id.textview); textView.setAllCaps(false);

以上方法任意一种都可以,设置后的显示效果如下:

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。