第一种方法:在drawable文件夹下新建一个文件设置背景样式
代码:
在drawable文件夹下面新建text_view_border.xml

<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:andro>
    <solid android:color="#80858175" />
    <stroke android:width="1dip" android:color="#aea594" />
      <corners android:topLeftRadius="2dp"    
        android:topRightRadius="2dp"     
        android:bottomRightRadius="2dp"    
        android:bottomLeftRadius="2dp"/>
</shape>

在布局文件调用

<TextView 
	android:
	android:layout_width="wrap_content" 
	android:layout_height="wrap_content"
	android:background="@drawable/text_view_border" />

在类文件中调用:

tv.setBackgroundResource(R.drawable.text_view_border); 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-20
猜你喜欢
  • 2022-12-23
  • 2021-11-10
  • 2021-07-27
  • 2021-08-01
  • 2021-12-16
  • 2022-12-23
相关资源
相似解决方案