Android layout 按dp更改布局高度,但它';为什么不在不同的设备中进行修复?

Android layout 按dp更改布局高度,但它';为什么不在不同的设备中进行修复?,android-layout,android-listview,android-ui,android-drawable,Android Layout,Android Listview,Android Ui,Android Drawable,在我的应用程序中,我使用一个列表视图,通过dp更改其布局高度。问题是,当我在emulator上运行我的应用程序时,列表视图在虚拟机上有一个良好的视图。但当我在手机上运行(galaxy y)时,手机无法修复。请帮帮我 这是我的xml <ListView android:id="@android:id/list" android:layout_width="match_parent" android:layout_height="335dp" android:l

在我的应用程序中,我使用一个列表视图,通过dp更改其布局高度。问题是,当我在emulator上运行我的应用程序时,列表视图在虚拟机上有一个良好的视图。但当我在手机上运行(galaxy y)时,手机无法修复。请帮帮我

这是我的xml

<ListView
    android:id="@android:id/list"
    android:layout_width="match_parent"
    android:layout_height="335dp"
    android:layout_margin="10dp"
    android:cacheColorHint="#00000000"
    android:background="@drawable/border_ui"
    android:listSelector="@drawable/item_border_selected" 
    >

</ListView>

如果您在dp中指定高度,那么它的高度也将取决于设备。相反,您应该使用wrapcontent或matchparent,以便listview在不同的设备上看起来相似