每次我尝试自定义视图的样式时,我都会遇到同样的问题。我可以更改哪些参数;以及如何覆盖系统默认值?例如:
ListView
单击时如何更改a元素的突出显示颜色- 如何更改
frame
a的默认值DialogFragment
?我的意思是使用 Style 删除的框架DialogFragment.STYLE_NO_FRAME
。
我在哪里可以检查我应该使用哪些值来实现我的自定义布局?
谢谢
每次我尝试自定义视图的样式时,我都会遇到同样的问题。我可以更改哪些参数;以及如何覆盖系统默认值?例如:
ListView
单击时如何更改a元素的突出显示颜色frame
a的默认值DialogFragment
?我的意思是使用 Style 删除的框架DialogFragment.STYLE_NO_FRAME
。我在哪里可以检查我应该使用哪些值来实现我的自定义布局?
谢谢
好吧,您可以通过在可绘制文件夹中创建一个新的 xml 文件来更改外观,但不要制作布局 xml,只需从向导中选择 andrid xml,它将提供您可以修改的组件列表,包括颜色。
<?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="@android:color/black" />
</shape>
</item>
<item android:top="1dp" android:left="2dp" android:right="2dp" android:bottom="25dp">
<shape android:shape="rectangle">
<solid android:color="@android:color/holo_purple" />
</shape>
</item>
<item android:top="1dp" android:left="400dp" android:right="2dp" android:bottom="1dp">
<shape android:shape="rectangle">
<solid android:color="@android:color/holo_purple" />
<corners android:bottomRightRadius="7dp"
android:bottomLeftRadius="7dp" android:topLeftRadius="7dp"
android:topRightRadius="7dp" />
</shape>
</item>
<item android:top="1dp" android:left="2dp" android:right="400dp" android:bottom="1dp">
<shape android:shape="rectangle">
<solid android:color="@android:color/holo_purple" />
<corners android:bottomRightRadius="7dp"
android:bottomLeftRadius="7dp" android:topLeftRadius="7dp"
android:topRightRadius="7dp" />
</shape>
</item>
</layer-list>
那么您可以更改所需的内容!但是提供一些代码,我将能够更好地回答..