Set ImageView width and height programmatically?

November 18, 2013   ·   0 Comments

Screen Shot 2013-11-18 at 8.01.52 PM

    Display display = getWindowManager().getDefaultDisplay(); 
int    mWidth = display.getWidth();  // deprecated
int    mHeight = display.getHeight();  // deprecated


ImageView  mStars= (ImageView) findViewById(R.id.star1);
				mStars.setImageResource(R.drawable.star0);
				if(mHeight<=320){  // 把星星改小
					LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(8, 8);
					mStars.setLayoutParams(layoutParams);
				}
shareShare on FacebookShare on Google+Share on LinkedInEmail this to someonePrint this pageBuffer this pageDigg thisFlattr the authorShare on RedditPin on PinterestShare on StumbleUponShare on TumblrTweet about this on Twitter

By


Readers Comments (0)


You must be logged in to post a comment.

PowenKo’s Online Store

powenko_arduinoBook
Android7

Amazon

adsbygoogle

Recent Posts

Categories

Amazon