阿拉伯语、波斯语等RTL语下menu菜单文字没有居右
时间:10-02
整理:3721RD
点击:
[DESCRIPTION]
把系统语言切换到阿拉伯语,波斯语等RTL语下,发现MMS、browser等应用的Menu、ActionBar的文
字没有居右或者会出现先居左在闪一下居右的问题,这个Google的设计缺陷,如果遇到此问题可以
按照如下办法解决:
[SOLUTION]
具体可以分为如下2种情况:
(1)阿拉伯语下浏览器菜单显示先显示为左对齐后闪到右对齐
解法:
\php?mod=tag&id=6090" target="_blank" class="relatedlink">Frameworks\base\core\java\android\widget\AbsListView.java
public void ontouchModeChanged(boolean isInTouchMode) {
if (isInTouchMode) {
// Get rid of the selection when we enter touch mode
hideSelector();
// Layout, but only if we already have done so previously.
// (Otherwise may clobber a LAYOUT_SYNC layout that was requested to restore
// state.)
if (getHeight() > 0 && getChildCount() > 0) {
// We do not lose focus initiating a touch (since AbsListView is focusable in
// touch mode). Force an initial layout to get rid of the selection.
// layoutChildren(); // 註解掉這行
requestLayout(); // 加上這行
}
updateSelectorState();
...
}
(2) 阿拉伯语下新建信息界面插入常用短语等菜单选项未右对齐
解法:
PopupWindow.java(frameworks\base\core\java\android\widget)
private void setLayoutDirectionFROMAnchor() {
if (mAnchor != null) {
View anchor = mAnchor.get();
if (anchor != null && mPopupViewInitialLayoutDirectionInherited) {
mPopupView.setLayoutDirection(anchor.getLayoutDirection());
}
}
int direct = mContext.getResources().getConfiguration().getLayoutDirection();//add is
line
mPopupView.setLayoutDirection(direct);//add this line
}
把系统语言切换到阿拉伯语,波斯语等RTL语下,发现MMS、browser等应用的Menu、ActionBar的文
字没有居右或者会出现先居左在闪一下居右的问题,这个Google的设计缺陷,如果遇到此问题可以
按照如下办法解决:
[SOLUTION]
具体可以分为如下2种情况:
(1)阿拉伯语下浏览器菜单显示先显示为左对齐后闪到右对齐
解法:
\php?mod=tag&id=6090" target="_blank" class="relatedlink">Frameworks\base\core\java\android\widget\AbsListView.java
public void ontouchModeChanged(boolean isInTouchMode) {
if (isInTouchMode) {
// Get rid of the selection when we enter touch mode
hideSelector();
// Layout, but only if we already have done so previously.
// (Otherwise may clobber a LAYOUT_SYNC layout that was requested to restore
// state.)
if (getHeight() > 0 && getChildCount() > 0) {
// We do not lose focus initiating a touch (since AbsListView is focusable in
// touch mode). Force an initial layout to get rid of the selection.
// layoutChildren(); // 註解掉這行
requestLayout(); // 加上這行
}
updateSelectorState();
...
}
(2) 阿拉伯语下新建信息界面插入常用短语等菜单选项未右对齐
解法:
PopupWindow.java(frameworks\base\core\java\android\widget)
private void setLayoutDirectionFROMAnchor() {
if (mAnchor != null) {
View anchor = mAnchor.get();
if (anchor != null && mPopupViewInitialLayoutDirectionInherited) {
mPopupView.setLayoutDirection(anchor.getLayoutDirection());
}
}
int direct = mContext.getResources().getConfiguration().getLayoutDirection();//add is
line
mPopupView.setLayoutDirection(direct);//add this line
}
