2011-09-27 50 views

回答

0

設置圖像的佈局參數,即大小不超過父視圖

LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(30, 30); 
yourImageView.setLayoutParams(layoutParams); 
+0

我會嘗試一下,謝謝。 – olidroide

+0

對不起@jazz,但我使用該代碼,並出現一個ClassCastException:'LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(10,10); \t \t ImageView iv =(ImageView)findViewById(R.id.first_image); \t \t \t \t iv.setLayoutParams(lp);' – olidroide