开发者

How to set full image in Absolute Layout in android

开发者 https://www.devze.com 2023-01-09 09:08 出处:网络
I have set image in AbsoluteLayout but it\'ll not display in full screen on G1 but when i run the same application in Nexus it is working properly.

I have set image in AbsoluteLayout but it'll not display in full screen on G1 but when i run the same application in Nexus it is working properly.

I have set setContentView(new Test(this)) in my activity class. Test is my AbsoluteLayout class.

My code looks like :

public class Test extends AbsoluteLayout {public Test(Context context) {
   super(context);
   final RelativeLayout rl = new RelativeLayout(context);
    final android.widget.RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
            LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
    rl.setLayoutParams(params);
    this.addView(rl, new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,
            LayoutParams.FILL_PARENT));

    ImageView mImageView = new ImageView(context);mImageView.setImageBitmap(((DataStorage)context.getApplicationContext()).getImage());
  开发者_StackOverflow  this.addView(mImageView);   }}

Can anyone tell me that why i am not getting full image on G1 mobile screen?


I have found the problem that i have not set

this.addView(mImageView, new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号