【问题标题】:round corners with repeated background image in the same button android在同一个按钮android中具有重复背景图像的圆角
【发布时间】:2013-10-08 16:33:14
【问题描述】:

有什么方法可以在按钮中添加背景图像,并且该按钮的角是圆角的

因为根据我看到的所有示例,我们设置bakground图像的属性是相同的,我们可以设置xml文件来制作圆角

那么知道图像背景必须重复,是否可以在同一个按钮中进行四舍五入

这是我制作圆角的代码:

    <?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="#FFFFFF" />    
    <stroke android:width="3dip" android:color="#B1BCBE" />
    <corners android:radius="10dip"/>
    <padding android:left="0dip" android:top="0dip" android:right="0dip" android:bottom="0dip" />
</shape>

这是重复背景图像的代码:

    <bitmap
xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/backtemplate"
android:tileMode="repeat"
android:dither="true" />

我想将这两个文件四舍五入到一个按钮中,以获得一个带有重复背景图像的圆角按钮

【问题讨论】:

    标签: android button background-image rounded-corners repeat


    【解决方案1】:

    尝试使用android:background 上的形状文件和android:src 上的图像。然后你可能不得不使用Scale Type

    【讨论】:

    • 我在按钮属性中没有找到 android:src
    • 你必须使用ImageButton
    • 但是如果你使用 ImageButton 那么你不支持文本。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-11
    • 2013-10-07
    • 2012-04-05
    • 1970-01-01
    • 2019-11-14
    • 2012-06-16
    相关资源
    最近更新 更多