-2

在为我的应用程序设计登录页面的过程中,我注意到我的主页上的图像根据屏幕(它应该)而有所不同,但我有时会看到扭曲的外观或重叠的外观。在类似主题的谷歌浏览各种文章的建议是将不同维度的图像放置在可绘制子文件夹(hdpi,mdpi,xhdpi,xxhdpi)中,有人甚至建议将单个图像放在no-hdpi文件夹中应播放招。请有人请指导我正确的轨道,也让我知道我怎么能从主图像是1024 * 720像素的大小的各种尺寸(hdpi,mdpi,xhdpi,xxhdpi)的图像。根据设备的Android图像缩放

下面是我的主要布局。 我有一个按钮,图像视图和图像按钮。我想要的是应该没有图像视图和图像按钮之间的差距/分隔。该按钮通过图像视图(工作正常)。

<?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> 
+0

http://stackoverflow.com/a/42780528/5471104 –

+0

'让我知道如何从主图像获得各种尺寸(hdpi,mdpi,xhdpi,xxhdpi)的图像,其尺寸为1024 * 720像素使用Gimp或类似的工具(2D图形编辑器) –

回答

0
Could somebody please guide me to the right track and also 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. 

可以使用Android Drawable Importer插件Android的工作室。我使用相同的导入资源。