Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/218.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 圆形按钮因内部文本长度而变形。_Android_Android Xml_Android Button - Fatal编程技术网

Android 圆形按钮因内部文本长度而变形。

Android 圆形按钮因内部文本长度而变形。,android,android-xml,android-button,Android,Android Xml,Android Button,我想买一个完美的圆形纽扣 我已经使用shape尝试了下面的代码。 但我面临的问题是,当视图中有两个文本时,它看起来几乎是一个圆,但当视图中有一个和三个字符时,它看起来是椭圆形的 形状代码 <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval" android:useLevel="true"> <corners android

我想买一个完美的圆形纽扣

我已经使用shape尝试了下面的代码。 但我面临的问题是,当视图中有两个文本时,它看起来几乎是一个圆,但当视图中有一个和三个字符时,它看起来是椭圆形的

形状代码

  <shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval"
    android:useLevel="true">


       <corners android:bottomRightRadius="20dip"
        android:bottomLeftRadius="20dip"  
        android:topRightRadius="20dip"
        android:topLeftRadius="20dip"
        />


       </shape>

请检查图片中数字2和22的近似圆形按钮 我对所有按钮(如上所述)使用了相同的代码

在布局文件(或代码)中,保持按钮的尺寸固定(宽度=高度=某些dp)。
例如:

layout_width="48dp"
layout_height="48dp"

能否显示使用此形状的xml布局?非常感谢。