2015-01-15 70 views
0

我想在android中調整動態圖像的大小,但是我不能,也許有人可以幫助我。我已經搜索的網頁,但沒有發現任何有用的東西......以編程方式更改android動態圖像大小

這是我用來創建和放置圖像的代碼:

 TableRow row = new TableRow(this); 
     row.setOnClickListener(this); 

     ImageView iv = new ImageView(this); 
     iv.setImageBitmap(getImage()); 

     TableRow.LayoutParams lp = new TableRow.LayoutParams(10, 10); 
     iv.setLayoutParams(lp); 
     row.addView(iv); 
+0

你是什麼意思通過調整動態圖像?你的目標是什麼? – bonnyz 2015-01-15 18:26:19

+0

調整大小=更改圖像的大小。例如,如果它是400x400像素,則將其更改爲10x10 – Draelach 2015-01-15 18:41:54

回答

0

一種可能的解決方案,根據您的片段:

//... 
    ImageView iv = new ImageView(this); 
    iv.setScaleType(ScaleType.CENTER_INSIDE); 
    iv.setImageBitmap(getImage()); 

    TableRow.LayoutParams lp = new TableRow.LayoutParams(10, 10); 
    row.addView(iv, lp); 
相關問題