---
title: "ActivityGroup 下 layout_weight不起作用"
author: "jguangyou"
date: "2012-04-01T19:43:30Z"
tags: []
categories: ["移动开发"]
slug: "activitygroup-layout-weight"
draft: false
lastmod: "2012-04-01T19:43:30Z"
id: 1472857
url: "https://deep-fish.iteye.com/blog/1472857"
---

一直比较喜欢用layout_weight属性来划分屏幕，今天在ActivityGroup中使用，怎么搞都不起作用，最终搞定，原来要给getDecorView()返回的View对象加上LayoutParams ，用法如下：
LayoutParams param = new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT);
如果getDecorView()返回的对象为appview则
appview.setLayoutParams(param);
这样在剩余空间在使用layout_weight属性就起作用了。。