我正在尝试使我的图像带有圆角。我就是这样
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:drawable="@drawable/bg" />
<item>
<shape android:shape="rectangle" android:padding="10dp">
<solid android:color="#00000000" />
<corners
android:bottomRightRadius="15dp"
android:bottomLeftRadius="15dp"
android:topLeftRadius="15dp"
android:topRightRadius="15dp"/>
<stroke android:width="3dp" android:color="#a9a9a9"/>
</shape>
</item>
</layer-list>
结果是这样的
您可以在圆角后面看到灰色,该如何删除?我想我缺少了一些东西。让我知道是否有人可以帮助我解决我的问题。 谢谢
答案 0 :(得分:3)
您可以使用cardView进行圆角尝试
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardCornerRadius="8dp"
android:layout_margin="5dp"
android:elevation="10dp">
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/bg"
android:scaleType="centerCrop"
/>
</android.support.v7.widget.CardView>
在您的代码中删除
<stroke android:width="3dp" android:color="#a9a9a9"/>
然后您可以删除灰色边框
答案 1 :(得分:1)
我不知道角落空间是否可移动。但是您可以将遮罩用作图像视图的前景。使用下面的xml创建掩码。
--Player Data
DECLARE @PlayerScore AS BIGINT
DECLARE @PlayerRank AS NVARCHAR(100)
IF EXISTS(SELECT [High_Score] FROM [dbo].[High_Scores] WHERE [Board_Name] = @Board AND [Difficulty] = @Difficulty AND [Email] = @Email) BEGIN
SET @PlayerScore = (SELECT [High_Score] FROM [dbo].[High_Scores] WHERE [Board_Name] = @Board AND [Difficulty] = @Difficulty AND [Email] = @Email)
SET @PlayerRank = (SELECT TOP 1 COUNT([High_Score]) FROM [dbo].[High_Scores] WHERE [Board_Name] = @Board AND [Difficulty] = @Difficulty ORDER BY [High_Score] DESC)
END ELSE BEGIN
SET @PlayerScore = 0;
SET @PlayerRank = 'UnRanked';
END
--Top 5 Player Scores
SELECT DISTINCT TOP 5
[High_Score] AS [Score],
[Player_Time],
[Board_Name],
[Email],
@PlayerScore AS 'Player_Score',
@PlayerRank AS 'Player_Rank'
FROM
[dbo].[High_Scores]
WHERE
[Board_Name] = @Board AND
[Difficulty] = @Difficulty
ORDER BY [High_Score] DESC, [Player_Time] DESC, [Email]
现在,如果您的最低SDK版本为23,则只需将drawable设置为前台。
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<stroke
android:color="#555555"
android:width="5dp"/>
</shape>
</item>
<item android:top="-1dp" android:bottom="-1dp" android:right="-1dp" android:left="-1dp">
<shape android:shape="rectangle">
<stroke
android:color="#555555"
android:width="6dp"/>
<corners android:radius="16dp"/>
</shape>
</item>
但是,如果您的目标受众是23岁以下,则可以尝试以下代码。
android:foreground="@drawable/mask"
答案 2 :(得分:0)
尝试
r
调整
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
>
<item>
<shape android:shape="rectangle">
<solid android:color="#398B27"/>
<corners android:radius="15dp" />
</shape>
</item>
<item
android:left="1dp"
android:right="1dp"
android:top="1dp"
android:bottom="1dp">
<shape android:shape="rectangle">
<solid android:color="@android:color/white"/>
<corners android:radius="15dp" />
</shape>
</item>
</layer-list>
获得欲望宽度
android:left="1dp"
android:right="1dp"
android:top="1dp"
android:bottom="1dp"