FAQ13715][Gallery] 如何修改gallery的背景色
来源:互联网 发布:淘宝的垃圾箱在哪里 编辑:程序博客网 时间:2024/05/29 13:26
Gallery的背景色定义在:
Gallery2/res/values/colors.xml 文件中
<!-- configuration for album set page -->
<color name="albumset_background">#1A1A1A</color>
<color name="albumset_background">#1A1A1A</color>
<!-- configuration for album page -->
<color name="album_background">#1A1A1A</color>
<color name="album_background">#1A1A1A</color>
<!-- configuration for photo page -->
<color name="photo_background">#1A1A1A</color>
<color name="photo_background">#1A1A1A</color>
上述3个定义分别对应了gallery3个page的背景色;
如果需要修改背景色为黑色,则需要将对应值修改为#000000;
如果需要修改背景色为白色,则需要将对应值修改为#FFFFFF。
L版本补充说明:
在L版本Photopage页面,背景色不再从上述文件中获得,则第三项修改不起效;
请参照如下方式进行修改:
PhotoPage.java
protected float[] getBackgroundColor() {
if (mModel != null && mModel.isCamera(0)) {
mPhotoPageBackgroundColor[0] = 0.0f;
} else {
mPhotoPageBackgroundColor[0] = 1.0f;
mPhotoPageBackgroundColor[1] = 1.0f;
mPhotoPageBackgroundColor[2] = 1.0f;
mPhotoPageBackgroundColor[3] = 1.0f;
Log.d(TAG, "PhotoPage.getBackgroundColor");
}
mBackgroundColor = mPhotoPageBackgroundColor;
return mPhotoPageBackgroundColor;
}
if (mModel != null && mModel.isCamera(0)) {
mPhotoPageBackgroundColor[0] = 0.0f;
} else {
mPhotoPageBackgroundColor[0] = 1.0f;
mPhotoPageBackgroundColor[1] = 1.0f;
mPhotoPageBackgroundColor[2] = 1.0f;
mPhotoPageBackgroundColor[3] = 1.0f;
Log.d(TAG, "PhotoPage.getBackgroundColor");
}
mBackgroundColor = mPhotoPageBackgroundColor;
return mPhotoPageBackgroundColor;
}
如上蓝色标示位置,都修改为1.0f则是白色;如果都修改为0.0f则是对应黑色。
补充问题分析:
修改整个window的theme为白色,再修改以上背景色为白色后,进入gallery时仍会闪出一帧黑色背景:
可尝试修改Gallery2/res/layout/gl_root_group.xml文件如下:
<View android:id="@+id/gl_root_cover"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black"
android:visibility="gone"/>
请将android:background="@android:color/black" 颜色修改为白色。
<View android:id="@+id/gl_root_cover"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black"
android:visibility="gone"/>
请将android:background="@android:color/black" 颜色修改为白色。
0 0
- FAQ13715][Gallery] 如何修改gallery的背景色
- 如何修改treeview的背景色
- 如何修改treeview的背景色
- 如何修改treeview的背景色
- 如何修改对话框的背景色
- 如何创建循环的gallery
- 如何修改android studio背景色(包括project view的背景色)保护眼睛人人有责
- Gallery
- Gallery
- Gallery
- gallery
- gallery
- Gallery
- gallery
- Gallery
- Gallery
- Gallery
- Gallery
- 微软提供的android模拟器
- EularProject 39:给周长判断构成直角三角形个数
- scrollview嵌套listview效果
- Cocos2dx之精灵批处理
- UART(接收部分)
- FAQ13715][Gallery] 如何修改gallery的背景色
- 使用genymotion和chares网络调试设置代理方法
- 1022. Digital Library (30)
- 16进制转10进制方法
- 10个学习Android开发的网站推荐
- org.hibernate.MappingException: Unknown entity 错误修改
- SpringMVC 流程(4)-- HttpMessageConverter
- poj 2186 Popular Cows(kosaraju求联通分量)
- UVA 1588 Kick Down