android 短息列表界面点击新建,Android 信息列表界面背景代码分析

一、短信列表有短信菜单项时,界面背景绘制:

1 ConversationList.java:

2 ..\packages\apps\Mms\res\layoutconversation_list_screen.xml:

android:layout_width="match_parent"

android:layout_height="match_parent"  >

style="?android:attr/listViewWhiteStyle"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:drawSelectorOnTop="false"

android:scrollbarStyle="insideOverlay"

android:background="@android:color/white"

android:cacheColorHint="@android:color/white"

android:fadingEdgeLength="16dip" />

android:layout_width="match_parent"

android:layout_height="match_parent"

android:gravity="center"

android:text="@string/no_conversations"

android:textAppearance="?android:attr/textAppearanceMedium" />

二、短信列表为空白时,界面背景绘制机制

1 ..\frameworks\base\policy\src\com\android\internal\policy\impl\PhoneWindow.java:

public class PhoneWindow extends Window implements MenuBuilder.Callback {

private void openPanel(PanelFeatureState st, KeyEvent event) {

int backgroundResId;

if (lp.width == ViewGroup.LayoutParams.MATCH_PARENT) {

// If the contents is fill parent for the width, set the

// corresponding background

backgroundResId = st.fullBackground;

width = MATCH_PARENT;

} else {

// Otherwise, set the normal panel background

backgroundResId = st.background;

}

st.decorView.setWindowBackground(getContext().getResources().getDrawable(

backgroundResId));

}

}

private final class DecorView extends FrameLayout implements RootViewSurfaceTaker {

/* package */int mDefaultOpacity = PixelFormat.OPAQUE;

public void setWindowBackground(Drawable drawable) {

if (getBackground() != drawable) {

setBackgroundDrawable(drawable);

if (drawable != null) {

drawable.getPadding(mBackgroundPadding);

} else {

mBackgroundPadding.setEmpty();

}

drawableChanged();

}

}

@Override

public void setBackgroundDrawable(Drawable d) {

super.setBackgroundDrawable(d);

if (getWindowToken() != null) {

updateWindowResizeState();

}

}

}

private static final class DrawableFeatureState {

void setStyle(Context context) {

TypedArray a = context.obtainStyledAttributes(com.android.internal.R.styleable.Theme);

background = a.getResourceId(

com.android.internal.R.styleable.Theme_panelBackground, 0);

fullBackground = a.getResourceId(

com.android.internal.R.styleable.Theme_panelFullBackground, 0);

}

}

}

2 ..\frameworks\base\core\res\res\values\Themes.xml:

@android:drawable/menu_background

@android:drawable/menu_background_fill_parent_width

3 ..\frameworks\base\core\res\res\drawable-hdpi:

menu_background.9.png

menu_background_fill_parent_width.9.png

0b1331709591d260c1c78e86d0c51c18.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值