【发布时间】:2017-04-18 07:25:17
【问题描述】:
在为我的应用程序设计登录页面的过程中,我注意到我的主页上的图像根据屏幕(它应该)而变化,但是我有时会看到扭曲或重叠的外观。浏览谷歌上关于类似主题的各种文章,建议将不同尺寸的图像放在可绘制的子文件夹(hdpi、mdpi、xhdpi、xxhdpi)中,有些人甚至建议在 no-hdpi 文件夹中放置单个图像应该播放诡计。有人可以引导我走上正确的道路,还可以让我知道如何从 1024*720 像素大小的主图像中获取各种尺寸(hdpi、mdpi、xhdpi、xxhdpi)的图像。
下面是我的主要布局。 我有一个按钮、图像视图和图像按钮。我想要的是图像视图和图像按钮之间不应该有间隙/分离。按钮出现在图像视图上(效果很好)。
<?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/LinearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<Button
android:id="@+id/about"
android:background="@android:color/transparent"
android:src="@drawable/download"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="centerCrop"
android:textSize="15sp"
android:adjustViewBounds="true"
android:paddingTop="-5dp"
android:text="About"
android:linksClickable="true"
android:layout_alignParentLeft="true"
android:textAlignment="center"
android:textColor="@color/orangered"/>
<ImageView
android:id="@+id/C_image_view"
android:src="@drawable/kamakshi"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="centerCrop"
android:layout_weight="5"/>
<ImageButton
android:id="@+id/download"
android:src="@drawable/download"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="@id/about"
android:layout_alignParentBottom="true"
android:scaleType="centerCrop"
android:layout_weight="5"
/>
</RelativeLayout>
【问题讨论】:
-
let me know how can i get images of various dimensions (hdpi, mdpi,xhdpi,xxhdpi) from the main image which is 1024*720 px in size.使用 Gimp 或类似工具(2D 图形编辑器)
标签: android android-layout android-studio screen-orientation screen-resolution