Android frameworks 开发总结之十(lock screen message Battery Last full charge)
1.設置lock screen message後不显示
XXXt設備設置lock screen message後,發現鎖頻界面不顯示內容,像時間日期都不顯示。只在右上角顯示一個鎖圖標,需要向下滑動一下才能顯示出來。布局文件位置: frameworks/base/packages/SystemUI/res-keyguard/layout/keyguard_status_view.xml 修改:frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java中的layoutOwnerInfo方法:
private void layoutOwnerInfo() {
if (mOwnerInfo != null && mOwnerInfo.getVisibility() != GONE) {
// Animate owner info during wake-up transition
mOwnerInfo.setAlpha(1f - mDarkAmount);
float ratio = mDarkAmount;
// Calculate how much of it we should crop in order to have a smooth transition
int collapsed = mOwnerInfo.getTop() - mOwnerInfo.getPaddingTop();
int expanded = mOwnerInfo.getBottom() + mOwnerInfo.getPaddingBottom();
int toRemove = (int) ((expanded - collapsed) * ratio);
mOwnerInfo.setTop(mIconTopMarginWithHeader * 4);
setBottom(getMeasuredHeight() - 50);
if (mNotificationIcons != null) {
// We're using scrolling in order not to overload the translation which is used
// when appearing the icons
mNotificationIcons.setScrollY(toRemove);
}
} else if (mNotificationIcons != null){
mNotificationIcons.setScrollY(0);
}
}
在其它设备上(在横屏的情况下不显示lock screen message,原因是字体过大导致的,修改方式:
private void updateOwnerInfo() {
if (mOwnerInfo == null) return;
String info = mLo