您的位置:首页 > 移动开发 > Android开发

android2.2 2.3状态栏区别

2013-11-06 22:26 519 查看
终于升完2.3版本,感触很多。2.3把状态栏提到framework/package里面,虽然修改是方便了,但注意的是它的样式还是取的framework/core/res/res/value中的style.xml和themes.xml文件。
在thems.xml中有这样一段代码:
<style name="Theme"> <item name="colorForeground">@android:color/bright_foreground_dark</item> <item name="colorForegroundInverse">@android:color/bright_foreground_dark_inverse</item> <item name="colorBackground">@android:color/background_dark</item>
<item name="colorBackgroundCacheHint">?android:attr/colorBackground</item> <item name="disabledAlpha">0.5</item> <item name="backgroundDimAmount">0.6</item> <!-- Text styles --> <item name="textAppearance">@android:style/TextAppearance</item> <item name="textAppearanceInverse">@android:style/TextAppearance.Inverse</item>
<item name="textColorPrimary">@android:color/primary_text_dark</item>
..................
</styles>
它控制了上层所有UI显示的样式,想让你的产品更hold就要改这里的,里面颜色则对应color.xml。
状态栏下来框优化则在status_bar_expanded.xml,里面UI具体怎么用你懂的,不在这里详解。
status_bar_latest_event.xml这个文件我在这里详解一下:它就是状态栏下拉控制滚动文件,在2.3修改过这里。
<!-- 2.3代码-->
<com.android.systemui.statusbar.TrackingPatternView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" />
<!-- 2.3代码 --> <View android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:background="#ffffffff" />
只要细心看就能发现google,把原来TrackingPatternView去掉了,而TrackingPatternView就是用画笔去绘制一张图片,而2.3把这个工作交给了StatusBarService.java文件。
TrackingPatternView代码如下:
public TrackingPatternView(Context context, AttributeSet attrs){
super(context, attrs); mTexture = BitmapFactory.decodeResource(getResources(), R.drawable.statusbar_updown_background); mTextureWidth = mTexture.getWidth(); mTextureHeight = mTexture.getHeight();
mPaint = new Paint(); mPaint.setDither(false);
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: