首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

android布局,求指教,该如何处理

2013-11-19 
android布局,求指教我在左侧放了菜单栏(类似于底部菜单栏),右侧放内容页设置如下,但是内容页还是靠左的,内

android布局,求指教
我在左侧放了菜单栏(类似于底部菜单栏),右侧放内容页设置如下,但是内容页还是靠左的,内容会覆盖掉菜单按钮,应该怎样将右侧的内容页向右移动菜单栏的宽度呢?求指教
public static final int bottom_layoutWidth = 60;//菜单栏宽度
 private void resizeLayout() {
  View customView = getChildAt(0);//右侧内容
  android.view.ViewGroup.LayoutParams params = customView.getLayoutParams();
  int screenWidth = GlobalUtils.getInstance().getScreenWidth();  //获取屏幕宽度
  int lessWidth = screenWidth - bottom_layoutWidth;
  params.width = lessWidth;
  customView.setPadding(bottom_layoutWidth, 0, 0, 0);
  customView.setLayoutParams(params);
 }
内容页的宽度确实减去了菜单栏的宽度,但是它是靠左的,右边有一部分就空着了,而内容却会覆盖掉菜单栏 android 布局 菜单
[解决办法]
customView.setTranslationX(bottom_layoutWidth);
或者 
customView.scrollBy(bottom_layoutWidth);
试试

热点排行