Android图片大小
我设计了此屏幕:Android图片大小
我正在redmi note3手机上测试它。我已将我的图像放在mipmap-xxhdpi中。所有图标的大小为144x144。但是这些看起来很大。我应该将其移至可绘制文件夹。我应该减少图像的大小。我已经读过xxhdpi的图标应该是144x144。我应该如何决定我的图像的大小。它将如何适应不同的屏幕密度? 这里是我的xml文件:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/login_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:background="@android:color/black"
tools:context=".ui.activity.LoginActivity"
android:isScrollContainer="true">
<ImageView
android:layout_centerHorizontal="true"
android:id="@+id/logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<TextView
android:layout_centerHorizontal="true"
android:layout_below="@id/logo"
android:id="@+id/welcome_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/welcome_text"/>
<EditText
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin"
android:layout_centerHorizontal="true"
android:id="@+id/email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/welcome_text"
android:hint="@string/user_name"
android:inputType="textEmailAddress"
android:paddingTop="@dimen/activity_horizontal_margin"
android:paddingBottom="@dimen/activity_horizontal_margin"
android:paddingStart="10dp"
android:paddingLeft="10dp"
android:drawableLeft="@mipmap/usr"
android:drawablePadding="10dp"
android:background="@drawable/edittext_border"/>
<EditText
android:paddingTop="@dimen/activity_horizontal_margin"
android:paddingBottom="@dimen/activity_horizontal_margin"
android:paddingStart="10dp"
android:paddingLeft="10dp"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin"
android:layout_centerHorizontal="true"
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/email"
android:hint="@string/pass"
android:inputType="textPassword"
android:drawablePadding="20dp"
android:drawableLeft="@mipmap/pass"
android:background="@drawable/edittext_border" />
<Button
android:layout_centerHorizontal="true"
android:textColor="@android:color/white"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:background="@color/signin_color_orange"
android:id="@+id/signin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/password"
android:text="Sign In" />
<ImageView
android:layout_below="@id/signin"
android:id="@+id/oval_sep"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/oval"
android:layout_centerHorizontal="true" />
<View
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:id="@+id/left_sep"
android:layout_below="@id/signin"
android:layout_toLeftOf="@+id/oval_sep"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="@color/border_color"/>
<View
android:layout_marginRight="@dimen/activity_horizontal_margin"
android:id="@+id/right_sep"
android:layout_below="@id/signin"
android:layout_toRightOf="@+id/oval_sep"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/border_color" />
<TextView
android:id="@+id/or_text"
android:elevation="8dp"
android:layout_toRightOf="@id/left_sep"
android:layout_below="@id/signin"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="OR"
android:textColor="@color/black_overlay"/>
<TextView
android:layout_centerHorizontal="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/signup_txt"
android:id="@+id/signup_txt"
android:layout_below="@id/oval_sep" />
<View
android:id="@+id/social_sep"
android:layout_below="@id/signup_txt"
android:layout_width="1dp"
android:layout_height="1dp"
android:background="@color/signin_color_orange"
android:layout_centerHorizontal="true"/>
<ImageButton
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:src="@drawable/google"
android:layout_below="@id/signup_txt"
android:background="@drawable/social_button_border"
android:id="@+id/google"
android:layout_toLeftOf="@+id/social_sep"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<ImageButton
android:layout_marginRight="@dimen/activity_horizontal_margin"
android:layout_marginLeft="-2dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:src="@mipmap/fb"
android:layout_below="@id/signup_txt"
android:layout_toRightOf="@id/social_sep"
android:background="@drawable/social_button_border_fb"
android:id="@+id/fb"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<View
android:id="@+id/btn_sep"
android:layout_below="@id/fb"
android:layout_width="1dp"
android:layout_height="1dp"
android:background="@android:color/transparent"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"/>
<Button
android:layout_toLeftOf="@id/btn_sep"
android:id="@+id/lost_pswd"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/account_border"
android:text="@string/lost_pswd"
android:layout_alignParentBottom="true"/>
<Button
android:background="@drawable/account_border"
android:text="@string/create_accnt"
android:id="@+id/crt_accnt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_toRightOf="@id/lost_pswd"/>
</RelativeLayout>
这取决于您设计PSD的分辨率。每个像素密度没有标准尺寸。例如,xhdpi中的任何图像必须是xxxhdpi大小的一半,但它们将在相应的设备上以相同的大小显示。如果你的PSD是用于xhdpi的,那么把你的裁剪图标放在你的xhdpi文件夹中。
您必须建立四个维度的文件,并给图像正确withs和相应的高度
例如:
android:width="@dimen/one"
...四?那么ldpi呢?还是xxxhdpi?我会说你需要**六个**文件。 –
首先,你必须把所有的,你会在使用的图片应用程序把他们放在可绘制的应用程对于不同的分辨率,有drawable-mdpi(中等分辨率-48x48),drawable-hdpi(高分辨率-72x72),drawable-xhdpi(超高分辨率-96x96),drawable-xxhdpi(超高分辨率 - 144x144) ),drawable-xxxhdpi(额外的超高分辨率 - 192x192)。
如果将每个分辨率图像放入其各自的文件夹中,应用程序大小可能会增加。所以为了避免把高分辨率的图像放在drawable-xxxhdpi里面,它会自动调整到剩下的分辨率。最佳做法是创建一个尺寸为192x192的图像,并将其放在drawable-xxxhdpi文件夹中。
'我把我的图片放在mipmap-xxhdpi. ** **错误**:您必须使用'drawable-xxhdpi'。由于mipmap仅适用于启动器图标**。您可能想阅读[官方文档](https://developer.android.com/guide/practices/ui_guidelines/icon_design.html) –