Android Button 的默认隐藏属性

最近发现在默认添加Button控件的时候,text属性上会默认使用全部大写的英文。那么想要原文展示应该设置那个属性呢?特此记录

1、在Android开发中,会常常用到Button这个控件,但在设置text文本显示的时候,跟我们想要的效果不一样。

2、如在xml中使用Button控件的时候:

<Button
	android:id="@+id/btnLogin"
	android:layout_width="match_parent"
	android:layout_height="wrap_content"
	android:text="Button"
/>

运行上面的代码会发现,我们的Button的文本全部转换成大写的了 BUTTON ,这?

3、如果想要跟我们的效果保持一致应该怎么办呢?很简单,一个属性

<Button
	android:id="@+id/btnLogin"
	android:layout_width="match_parent"
	android:layout_height="wrap_content"
	android:text="Button"
	android:textAllCaps="false"
/>

猜你喜欢

转载自blog.csdn.net/qq_24523279/article/details/90205981