Java 高屏幕密度设备上的大型元件
我有一个在布局中包含元素(按钮、图像等)的应用程序。所有图像都在ldpi、mdpi等资源中,xxhdpi。如果我在平板电脑7(800x480)上运行应用程序,元素的大小“正确”。但如果我在三星Galaxy S3 mini 4(屏幕大小480x800)上运行应用程序,元素太大 如何自动减小元素的大小?我试图插入这些行以显示,但没有成功Java 高屏幕密度设备上的大型元件,java,android,android-layout,dpi,screen-size,Java,Android,Android Layout,Dpi,Screen Size,我有一个在布局中包含元素(按钮、图像等)的应用程序。所有图像都在ldpi、mdpi等资源中,xxhdpi。如果我在平板电脑7(800x480)上运行应用程序,元素的大小“正确”。但如果我在三星Galaxy S3 mini 4(屏幕大小480x800)上运行应用程序,元素太大 如何自动减小元素的大小?我试图插入这些行以显示,但没有成功 <supports-screens android:xlargeScreens="true" android:smallScreens="true" andr
<supports-screens android:xlargeScreens="true" android:smallScreens="true" android:largeScreens="true" android:normalScreens="true"
android:resizeable="true" />
编辑
这里是图片
错
好
资料来源:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="right" >
<ImageButton
android:id="@+id/btnremove"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/close"
android:onClick="btnRemoveSong"
android:contentDescription="@string/remove"
android:layout_marginRight="20dp" />
<ImageButton
android:id="@+id/btnUp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/move_up"
android:onClick="moveUp"
android:src="@drawable/up" />
<ImageButton
android:id="@+id/btnDown"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/down"
android:contentDescription="@string/move_down"
android:onClick="moveDown"
android:layout_marginRight="20dp" />
<TextView
android:id="@+id/txvCurrentSong"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:singleLine="true"
android:text="@string/play_with"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
<ListView
android:id="@+id/listMP3"
android:layout_width="match_parent"
android:layout_height="0dp"
android:scrollbarAlwaysDrawVerticalTrack="true"
android:layout_weight="1" >
</ListView>
<SeekBar
android:id="@+id/progress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ImageButton
android:id="@+id/btnBack"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_backward"
android:contentDescription="@string/backward"
android:onClick="backward"
android:layout_marginRight="10dp" />
<ImageButton
android:id="@+id/btnPlay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_play"
android:contentDescription="@string/play"
android:onClick="playPause"
android:layout_marginRight="10dp" />
<ImageButton
android:id="@+id/btnStop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_stop"
android:contentDescription="@string/stop"
android:onClick="stop"
android:layout_marginRight="10dp" />
<ImageButton
android:id="@+id/btnForward"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_forward"
android:contentDescription="@string/forward"
android:onClick="forward"
android:layout_marginRight="20dp" />
<TextView
android:id="@+id/txvProgress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:singleLine="true"
android:text="@string/play_status"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
好的,我为layout-sw600制定了具体的宽度和高度。其解决方案好的,我为layout-sw600制定了具体的宽度和高度。它的解决方案请随意发布一些屏幕截图来说明您的问题。此外,请随时发布不符合您要求的代码(例如布局资源)。您可以尝试为特定屏幕设计布局,如布局大型布局xlarge等。。您可以选择为特定屏幕进行设计,如layout600w。通过将布局文件保存在layout large文件夹中进行检查,并且400X800屏幕大小将仅从mdpi文件夹读取图像,而不是从hdpi或xhdpi文件夹读取图像。。。所以你的布局在屏幕上看起来很大。我只有一个文件夹“布局”。我要创建一个大文件夹吗?如何更改layout large文件夹中的XML?我创建了layout large和layout-sw600。但是我不知道怎么用?我将xml布局复制到这些文件夹中,如果我有权,我必须手动更改这些文件夹中元素的大小?请随意发布一些屏幕截图来说明您的问题。此外,请随时发布不符合您要求的代码(例如布局资源)。您可以尝试为特定屏幕设计布局,如布局大型布局xlarge等。。您可以选择为特定屏幕进行设计,如layout600w。通过将布局文件保存在layout large文件夹中进行检查,并且400X800屏幕大小将仅从mdpi文件夹读取图像,而不是从hdpi或xhdpi文件夹读取图像。。。所以你的布局在屏幕上看起来很大。我只有一个文件夹“布局”。我要创建一个大文件夹吗?如何更改layout large文件夹中的XML?我创建了layout large和layout-sw600。但是我不知道怎么用?我将xml布局复制到这些文件夹中,如果我有权,我必须手动更改这些文件夹中元素的大小?