<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linearLayout_parent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center_horizontal"
android:orientation="vertical" >
<RelativeLayout
android:id="@+id/relativeLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent">
。。。。。
RelativeLayout relativeLayout = (RelativeLayout)this.findViewById(R.id.relativeLayout1);
RelativeLayout.LayoutParams param = new RelativeLayout.LayoutParams(cell_Width, LayoutParams.MATCH_PARENT);
param.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, 1);
relativeLayout.setLayoutParams(param);
04-01 23:49:13.572: E/AndroidRuntime(1246): java.lang.ClassCastException: android.widget.RelativeLayout$LayoutParams cannot be cast to android.widget.LinearLayout$LayoutParams
relativeLayout 是LinearLayout的子控件~它的layoutparam应该是LinearLayout给他的所以应该是LinearLayout.LayoutParam ~~~~不知道你理解了没~~~如果relativeLayout 有子控件的话~那它的子控件用的的就是relativeLayout 给他们的RinearLayout.LayoutParam
~~~