[問題] canvas取得寬高問題
開發層: (應用/框架/庫/核心)
APP
問題:
請問我想在手機螢幕上畫圖 且適用於不同螢幕尺寸的手機
所以我想先取得每支手機的Canvas寬高
我的context view裡的onDraw方法如下:
public void onDraw(Canvas canvas)
{
String TAG= "MY";
int h= canvas.getHeight();
int w= canvas.getWidth();
int d= canvas.getDensity();
Log.v(TAG, "高\t"+ h);
Log.v(TAG, "寬\t"+ w);
Log.v(TAG, "Density\t"+ d);
}
然後我在DDMS中找TAG的訊息 顯示的是:
高 533
寬 320
Density 160
我用的手機是HTC Desire 解析度應該是800x480
為什麼顯示的只有533x320呢
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 210.240.176.185
→
06/07 16:49, , 1F
06/07 16:49, 1F
→
06/07 18:09, , 2F
06/07 18:09, 2F
→
06/07 18:10, , 3F
06/07 18:10, 3F
→
06/07 20:22, , 4F
06/07 20:22, 4F
→
06/07 20:23, , 5F
06/07 20:23, 5F
→
06/07 20:23, , 6F
06/07 20:23, 6F
→
06/07 20:23, , 7F
06/07 20:23, 7F
→
06/07 20:50, , 8F
06/07 20:50, 8F
→
06/07 20:51, , 9F
06/07 20:51, 9F
推
06/07 21:34, , 10F
06/07 21:34, 10F
推
06/07 21:35, , 11F
06/07 21:35, 11F
推
06/07 23:08, , 12F
06/07 23:08, 12F
→
06/07 23:51, , 13F
06/07 23:51, 13F
→
06/07 23:51, , 14F
06/07 23:51, 14F
→
06/07 23:54, , 15F
06/07 23:54, 15F
推
06/08 00:07, , 16F
06/08 00:07, 16F
→
06/08 00:10, , 17F
06/08 00:10, 17F
→
06/08 00:11, , 18F
06/08 00:11, 18F
→
06/08 00:11, , 19F
06/08 00:11, 19F
→
06/08 00:11, , 20F
06/08 00:11, 20F
→
06/08 00:18, , 21F
06/08 00:18, 21F
→
06/08 09:48, , 22F
06/08 09:48, 22F
→
06/08 09:49, , 23F
06/08 09:49, 23F
→
06/08 11:16, , 24F
06/08 11:16, 24F
→
06/08 11:16, , 25F
06/08 11:16, 25F
→
06/08 11:17, , 26F
06/08 11:17, 26F
→
06/08 14:06, , 27F
06/08 14:06, 27F
→
06/08 23:46, , 28F
06/08 23:46, 28F
→
06/08 23:47, , 29F
06/08 23:47, 29F
AndroidDev 近期熱門文章
PTT數位生活區 即時熱門文章