package com.example.ctream;
import android.app.Activity;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.RelativeLayout;
public class registerthree_part1 extends Activity{
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.main_layout);
ImageView imageView=(ImageView)findViewById(R.id.add);
RelativeLayout.LayoutParams relativeLayout=(RelativeLayout.LayoutParams)imageView.getLayoutParams();
relativeLayout.height=500;
relativeLayout.width=500;
imageView.setLayoutParams(relativeLayout);
}
import android.app.Activity;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.RelativeLayout;
public class registerthree_part1 extends Activity{
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.main_layout);
ImageView imageView=(ImageView)findViewById(R.id.add);
RelativeLayout.LayoutParams relativeLayout=(RelativeLayout.LayoutParams)imageView.getLayoutParams();
relativeLayout.height=500;
relativeLayout.width=500;
imageView.setLayoutParams(relativeLayout);
}
}
LinearLayout里面也是有LayoutParams属性的。
因为getLayoutParams和setLayoutParams都是控件基类view的公共方法,所以可以直接调用。