【发布时间】:2016-12-06 16:28:12
【问题描述】:
我有一个带有简单回收视图的应用。
布局声明如下
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/contentView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/some_id" />
</RelativeLayout>
我注意到在不同的设备上,recyclerView 实际上有不同的背景。在较新的设备中,背景只是白色。在旧设备上,背景为浅灰色。
在 android studio 中,设计视图中的背景颜色为空白。
所以我的问题是,这种灰色是从哪里来的?我怎样才能将其普遍更改为白色?
我显然可以在这个特定的视图中添加背景:白色。但是有没有办法覆盖系统默认值?
【问题讨论】:
-
除非你有大量的 RecyclerViews,否则这完全是矫枉过正。这可能与在整个系统版本中更改的默认系统设置有关。只需设置背景颜色即可。
-
对我来说是#f6f6f6,我通过反复试验实现了它。 :-)
标签: android