直接上代码,就一个layout文件:    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">
       
        <EditText android:layout_width="match_parent"
                  android:layout_height="50px"/>        <EditText android:layout_width="match_parent"
                  android:layout_height="34dp"/>
                  
        <EditText android:layout_width="match_parent"
                  android:layout_height="34dp"/>    </LinearLayout>
输出结果:
环境:
Android 2.3.3 API 10 + emulator default WVGA(800*480)
Density:240问题:
1,第一个 EditText 高度是50px,显示却是64像素左右
2,第二,三个EditText高度是34dp,显示像素是40左右为什么呢?我的理解:
1,如果是px表示,无论什么分辨率和密度,都应该显示相应的像素值
2,如果是dp表示,由于密度是240,所以实际显示像素应该是  34*(240/160) = 51,不应该是41在线等达人~~