【发布时间】:2015-11-19 01:27:03
【问题描述】:
我想向上移动按钮和向下移动文本视图。按钮正在向上移动,但它出现在 textview 上。 Textview 没有下来。
Button b;
TextView t;
public void btnclick(View v){
b= (Button) v;
t= (TextView) findViewById(R.id.tv);
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) t
.getLayoutParams();
params.addRule(RelativeLayout.BELOW, b.getId());
b.setLayoutParams(params);
}
【问题讨论】:
-
你为什么不在 xml 本身做这个?
-
因为我想在点击后改变它的位置...
-
试试
b.setLayoutParams(params); -
尝试改变textview的参数...
标签: android