我在左侧放了菜单栏(类似于底部菜单栏),右侧放内容页设置如下,但是内容页还是靠左的,内容会覆盖掉菜单按钮,应该怎样将右侧的内容页向右移动菜单栏的宽度呢?求指教
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布局菜单
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布局菜单
解决方案 »
- xml解析问题
- BaseExpandableListAdapter 的getGroupView方法被重复调用的问题
- webview在启动时,有一个空白页面,这个空白页面如何换成动画的显示方式
- Surfaceview lockCanvas 锁特定rect的问题
- 如何实现微博帐号登陆第三方网站
- 帮忙看下这错误如何解决
- listview显示问题
- 安卓环境搭建。
- 获取平板手机休眠状态
- adb forward tcp:9222为什么只能通过http://localhost:9222访问
- Android UDP setReceiveBufferSize
- android 自己根据实例activity类和xml关联运行时报错是怎么回事
或者
customView.scrollBy(bottom_layoutWidth);
试试
非常感谢您的回答
使用customView.setTranslationX(bottom_layoutWidth);的时候在他的下一行的末尾出现红色波浪线报错
customView.scrollBy(bottom_layoutWidth);也只是把右边部分的内容移动了