这是我的布局代码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical" >
<TableLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="5dp"
android:gravity="center" >
<TableRow
android:id="@+id/tableRow1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_margin="5dp"
android:layout_weight="1"
android:background="@drawable/round"
android:scaleType="fitXY" />
<ImageView
android:id="@+id/imageView2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_margin="5dp"
android:layout_weight="1"
android:background="@drawable/roundp"
android:scaleType="fitXY"/>
</TableRow>
<TableRow
android:id="@+id/tableRow2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1" >
<ImageView
android:id="@+id/imageView3"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_margin="5dp"
android:layout_weight="1"
android:background="@drawable/roundp"
android:scaleType="fitXY" />
<ImageView
android:id="@+id/imageView4"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_margin="5dp"
android:layout_weight="1"
android:scaleType="fitXY" />
</TableRow>
</TableLayout>
</LinearLayout>
roundp.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners
android:topRightRadius="0dp"
android:bottomLeftRadius="25dp"
android:topLeftRadius="25dp"
android:bottomRightRadius="0dp"/>
<stroke
android:width="2dp"
android:color="@color/red" />
<solid
android:color="@color/white"/>
</shape>
圆形.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners
android:topRightRadius="25dp"
android:bottomLeftRadius="0dp"
android:topLeftRadius="0dp"
android:bottomRightRadius="25dp"/>
<stroke
android:width="2dp"
android:color="@color/red" />
<solid
android:color="@color/white"/>
</shape>
如果我没有在 ImageView 中放置任何图像,我可以看到带有圆角的空 ImageView,在放置图像圆角后,正常的矩形形状与图像一起显示。如何解决这个问题?
任何帮助将不胜感激。