RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.WRAP_CONTENT,
RelativeLayout.LayoutParams.WRAP_CONTENT);
params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
params.addRule(RelativeLayout.CENTER_HORIZONTAL);
indicatorLayout.setLayoutParams(params);
你這段代碼寫在哪裡的,是在onCreate裡麼?有沒有執行?
這裡有一個比較完整的例子,參考下:http://www.linuxidc.com/Linux/2011-10/44509.htm