0
我目前有一个坐在ListView下面的TextView,并希望主题TextView,使它看起来像列表中的一个项目(例如,顶部和底部的灰色边框)。什么是实现这一目标的最佳方式?Android:如何为TextView设置主题,使其看起来像ListView中的项目?
我目前有一个坐在ListView下面的TextView,并希望主题TextView,使它看起来像列表中的一个项目(例如,顶部和底部的灰色边框)。什么是实现这一目标的最佳方式?Android:如何为TextView设置主题,使其看起来像ListView中的项目?
创建一个可绘制的xml文件以创建具有渐变背景的形状。
textview_background.xml:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="#333"
android:centerColor="#000"
android:endColor="#676"
android:angle="270"/>
<stroke
android:width="2dp"
android:color="#80808080"/>
</shape>
保存在您的绘制目录,并称之为
在布局中要使用什么背景android:background="@drawable/textview_background"
。文本视图,布局,按钮...
这应该会给你一些接近你想要的东西,我认为。
渐变中使用的颜色是三重十六进制,我认为你可以使用正常的十六进制。