Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android普通hdpi到大型hdpi设计需要帮助_Android_Android Layout - Fatal编程技术网

Android普通hdpi到大型hdpi设计需要帮助

Android普通hdpi到大型hdpi设计需要帮助,android,android-layout,Android,Android Layout,我对android布局设计的分辨率/密度有一些问题 例如,我在AVD 4“480x800 hdpi(普通焊盘)中使用了相似的基本尺寸,这是显示的结果 对于AVD 7“800x600 hdpi(大焊盘)中的相同布局,如下所示 这是布局代码 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" andr

我对android布局设计的分辨率/密度有一些问题

例如,我在AVD 4“480x800 hdpi(普通焊盘)中使用了相似的基本尺寸,这是显示的结果

对于AVD 7“800x600 hdpi(大焊盘)中的相同布局,如下所示

这是布局代码

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/fondo_main"
    android:gravity="center"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/tittle"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="left|center_vertical"
        android:layout_marginBottom="15dp"
        android:layout_marginLeft="5dp"
        android:layout_marginTop="10dp"
        android:background="@color/fondo_main"
        android:text="Menu Principal"
        android:textColor="@color/azul_asde"
        android:textSize="25sp" />

    <TableLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginBottom="50dp"
        android:layout_marginLeft="20dp"
        android:layout_marginRight="20dp"
        android:layout_marginTop="10dp"
        android:background="@drawable/roundcorners"
        android:gravity="center" >

        <TableRow
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="2"
            android:gravity="center"
            android:orientation="horizontal" >

            <ImageView
                android:id="@+id/buttonnewreg"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:scaleType="fitCenter"
                android:src="@drawable/nuevopac3" />

            <ImageView
                android:id="@+id/buttonviewreg"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:scaleType="fitCenter"
                android:src="@drawable/verpac4" />

            <ImageView
                android:id="@+id/buttonconfig"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:scaleType="fitCenter"
                android:src="@drawable/config5" />
        </TableRow>

        <TableRow
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginTop="10dp"
            android:layout_weight="1"
            android:gravity="center"
            android:orientation="horizontal" >

            <TextView
                android:id="@+id/Textheadwelcome2"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:gravity="center"
                android:text="Nueva ficha"
                android:textColor="@color/azul_asde"
                android:textSize="16sp"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/Textheadwelcome2"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:gravity="center"
                android:text="Ver fichas"
                android:textColor="@color/azul_asde"
                android:textSize="16sp"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/Textheadwelcome2"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:gravity="center"
                android:text="Configuración"
                android:textColor="@color/azul_asde"
                android:textSize="16sp"
                android:textStyle="bold" />
        </TableRow>
    </TableLayout>

</LinearLayout>

图像的大小是100x100像素,我怀疑如何选择图像的像素大小作为HDPI的基础,并从中增加到xhdpi或减少到mdpi

面对与您可以控制图像大小的相同类别的像素密度(hdpi),因为很明显,问题在于800x1200的屏幕分辨率为480x800。尽管800x1200使用hdpi,但清楚地看到图像更小


感谢

您观察到的结果是两个屏幕的dpi大致相同(因此使用相同的图像分辨率)。您还将注意到,由于7英寸平板电脑的屏幕空间比4英寸手机的屏幕空间更大,因此字体没有缩放

不过,要在所有设备上实现完全相同的外观是很困难的。并非所有设备都具有相同的纵横比或方向

我假设您不想手动设置每个屏幕元素;也许你应该专注于图像本身,并用android:scaleType=“FIT_CENTER”修复它们。但这可能会由于位图大小的调整而导致一些模糊


另一种方法是使用矢量图像,例如带有库的SVG,以减少模糊。

在此处查看我的ans如何解决相同密度下分辨率增加过多的问题?例如,Galaxy Nexus 10具有密度XHDPI,但其分辨率为2560x1600,而标准平板电脑的分辨率为1280x800。ThanksHow什么可以解决问题?缩放还是使用矢量图像?N10的问题可以通过为XHDPI制作一个图像版本并将其放在可绘制的XHDPI文件夹中(或者改用矢量图像)来解决。缩放只解决了7英寸和10英寸设备的问题,这两个设备都支持XHDPI。嗨,谢谢你的提问。我的项目的所有图像都有一个
XHDPI
,但问题是
Nexus 10
2560x1600
屏幕分辨率保持
XHDPI
密度(而不是
XXHDPI
)此屏幕分辨率中的图像在
XHDPI
版本中显示非常小。
XHDPI
图像显示“正确”标准平板电脑的尺寸为1280x800。对不起,如果我解释不正确。是的,但如果你缩放它们,它们会显得更大,不是吗?你没有。您只需定义布局,使图像视图根据可用屏幕空间隔开(使用
layout\u weight
属性),将其缩放类型设置为适合中心,并使其调整图像大小。Android将根据设备显示密度选择要加载的分辨率位图。我希望我明白你想问什么。