android - 具有重复模式的 BitmapDrawable 的圆角

标签 android android-drawable

我想将 LinearLayout 的背景设置为可绘制对象。

我能以某种方式把它的角弄圆吗,因为它可以用 shape and gradient? 来完成。

主要问题是我需要重复位图以匹配 View 的大小

最佳答案

试试这个并将它作为免费添加到您的 Xml 项目中:

<?xml version="1.0" encoding="utf-8"?>
    <shape xmlns:android="http://schemas.android.com/apk/res/android" >
          <solid android:color="#dadada"/> 
                 <corners
                       android:topLeftRadius="13dip"
                       android:topRightRadius="13dip"
                       android:bottomLeftRadius="13dip"
                       android:bottomRightRadius="13dip"/>
         <stroke android:width="1dip" android:color="#ff000000"/>
   </shape>

编辑:您可以在 LinearLayout 中定义一个 ImageView,然后可以将其背景设置为圆形

ImageView IV=(ImageView)findViewById(R.id.imageView);
IV.setBackgroundResource(R.drawable.round_border); 

关于android - 具有重复模式的 BitmapDrawable 的圆角,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14586113/

相关文章:

android - 高程产生的阴影显示为可绘制的圆形作为背景但不是矩形

android - 可绘制资源缩放的良好实践

android - 用于从在三星浏览器/Firefox 等中不起作用但在 Chrome 中起作用的链接打开应用程序的 Intent 过滤器

java - Zebra Android SDK 中对字体的支持

android - 如何在 ListView 中显示 RadioButton 和 EditText?

android - 快速按键事件模拟​​(Android Shell)

java - 如何在android中的图层列表中更改项目可绘制颜色

android - Android中的样式底线

android - 为什么当我触摸 ImageView 时,应用于 ImageView 的状态列表可绘制对象不使用按下状态的可绘制对象?

java - 如何在两个线程之间共享对象(线程同步)?