Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/198.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android Kotlin按钮中的文本垂直居中_Android_Button_Text_Center - Fatal编程技术网

Android Kotlin按钮中的文本垂直居中

Android Kotlin按钮中的文本垂直居中,android,button,text,center,Android,Button,Text,Center,尝试将按钮内的文本垂直居中。我已将重心设置为垂直中心: android:gravity=“center_卧式| center_立式 对于标准字体来说,这很好。但是,对于独特的字体,特别是“@font/bangers”,按钮中的文本不是垂直居中的-它的垂直偏移非常明显 是否还有另一个属性(行距和行高似乎不起作用)需要更新以设置可能具有不同类型设置的字体?我在一个测试项目中也遇到过这个问题。我设置了android:layout\u height=“warp\u content“并使用paddingT

尝试将按钮内的文本垂直居中。我已将重心设置为垂直中心:

android:gravity=“center_卧式| center_立式

对于标准字体来说,这很好。但是,对于独特的字体,特别是“@font/bangers”,按钮中的文本不是垂直居中的-它的垂直偏移非常明显


是否还有另一个属性(行距和行高似乎不起作用)需要更新以设置可能具有不同类型设置的字体?

我在一个测试项目中也遇到过这个问题。我设置了
android:layout\u height=“warp\u content“
并使用
paddingTop
paddingBottom
完成了这个技巧