Android 安卓戒指/椭圆形呈方形?

Android 安卓戒指/椭圆形呈方形?,android,android-layout,shape,Android,Android Layout,Shape,我在android中有一个列表视图项,它在android studio中正确显示,但当我将其移动到手机时,它在实际构建中显示为方形 谁能帮我解决这个问题吗 布局 矩形 在绘制的矩形中使用圆角半径使其变圆: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"&

我在android中有一个列表视图项,它在android studio中正确显示,但当我将其移动到手机时,它在实际构建中显示为方形 谁能帮我解决这个问题吗

布局

矩形


在绘制的矩形中使用圆角半径使其变圆:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" 
  android:shape="rectangle">
    <solid android:color="#5490CC"></solid>
    <size android:width="26dp" android:height="26dp"/>
    <corners android:radius="13dp"/>
</shape>

您在rectangle.xml中使用的是
android:shape=“rectangle”
。将其用作android:shape=“oval”(如果您想要椭圆形),如下所示

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" 
  android:shape="oval">
    <solid android:color="#5490CC"></solid>
    <size android:width="26dp" android:height="26dp"/>
    <corners android:radius="13dp"/>
</shape>


我希望它对你有用

我希望它对你有用

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

      <solid android:color="#5490CC" />

      <size
        android:width="60dp"
        android:height="60dp" />

  </shape>

您正在绘制一个矩形,它显示为一个矩形,但您希望它是椭圆形的,我遗漏了什么吗?
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" 
  android:shape="oval">
    <solid android:color="#5490CC"></solid>
    <size android:width="26dp" android:height="26dp"/>
    <corners android:radius="13dp"/>
</shape>
  <shape xmlns:android="http://schemas.android.com/apk/res/android"
      android:shape="oval">

      <solid android:color="#5490CC" />

      <size
        android:width="60dp"
        android:height="60dp" />

  </shape>