ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

即使我为每个可绘制文件夹调整了位图的大小,为什么我的Android可绘制对象仍然存在问题?

2019-11-22 02:24:28  阅读:280  来源: 互联网

标签:image bitmap android-drawable imagebutton android


为了支持多种屏幕尺寸,我使用Inkscape创建了一些图像,并将它们分别以不同的dp单位导出到可绘制文件夹中.首先,我为平板电脑创建了图像,并在华硕变压器上进行了测试,一切看起来都不错.因此,我将平板电脑图像放入了drawable-xhdpi,每个图像均为160dp.因此,对于每个图像,我分别以drawd-hdpi,drawable-mdpi和drawable-ldpi文件夹(基于Android建议的8:6:4:3缩放比例)分别以120dp,80dp和60dp导出新图像.

但是,当我在galaxy s3和LG Ally上进行测试时,图像显得过大,并且无法全部显示在屏幕上.我已包含< support-screen />在清单中明确“支持”所有屏幕.我将anyDensity设置为true.我在Eclipse中刷新了项目文件夹,并进行了干净的构建.

我正在使用带有ImageView和一些ImageButtons的LinearLayout:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF"
tools:context=".StarsMenu" >

<ImageView
    android:id="@+id/img_title"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:src="@drawable/title" />

<ImageButton
    android:id="@+id/img_play_btn"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:background="@drawable/menu_play_imgs"/>

<ImageButton
    android:id="@+id/img_practice_btn"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:background="@drawable/menu_pract_imgs"/>

<ImageButton
    android:id="@+id/img_about_btn"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:background="@drawable/menu_about_imgs" />

这是清单:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.vpbailey.RememberTheStars"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="18" />

<supports-screens 
    android:anyDensity="true"
    android:smallScreens="true"
    android:normalScreens="true"
    android:largeScreens="true"
    android:xlargeScreens="true" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.vpbailey.RememberTheStars.StarsMenu"
        android:label="@string/app_name" 
        android:theme="@style/FullscreenTheme"
        android:screenOrientation="portrait">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

我不知道如何从这里开始.对我来说,我做错了什么不是很明显,但是我感觉到它缺少的确很简单,因为这是我的第一个Android应用程序.
提前致谢 :)

解决方法:

Galaxy S3的密度是xhdpi.密度比是这样的:

mdpi:hdpi:xhdpi:xxhdpi:xxxhdpi: 1x:1.5x:2x:3x:4x

xxhdpi用于Galaxy s4等手机.

xxxhdpi用于Galaxy x5之类的电话.

对于三星Galaxy S3,您需要创建文件夹drawable-sw360dp并相应保存图像.

下面的链接将给您更多的想法:

http://developer.android.com/design/style/iconography.html

希望能帮助到你

标签:image,bitmap,android-drawable,imagebutton,android
来源: https://codeday.me/bug/20191122/2056438.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有