你没有.这不是线性布局的作用.请改用
RelativeLayout.
XML
android:layout_height="fill_parent">
android:layout_height="wrap_content"
android:text="Hello, World!"
android:layout_alignParentRight="true"/>
编程
public void makeView(Context context) {
RelativeLayout rl = new RelativeLayout(context);
TextView tv = new TextView(context);
tv.setText("Hello, World");
RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams
(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
lp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
rl.addView(tv, lp);
}