低质量的图像android开发 [英] Low quality image android development
问题描述
我制作了一张Photoshop图片480x2500,我想将其放入我的一项活动中. 但是,安装.apk后,图像质量较低.我真的尝试了我在google上找到的所有内容,但没有结果.我不是一个经验丰富的程序员,所以请花些时间并解释所有对我有帮助的东西. 这是我的代码:
I made a photoshop image 480x2500 which I want to put in one of my activities. But, after installing the .apk, the image has low quality. I really tried everything I found on google, without results. I'm not an experienced programmer so please take you time and explain everything that can help me. Here are my codes:
XML:
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dip"
android:tileMode="repeat"
android:dither="true">
<ImageView
android:id="@+id/imageView2"
android:layout_width="fill_parent"
android:layout_height="1166dp"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:src="@drawable/secondbutton3" />
Java代码
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.PixelFormat;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.view.Menu;
import android.view.WindowManager;
public class Secondbutton extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_secondbutton);
getWindow().setFormat(PixelFormat.RGBA_8888);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DITHER);
BitmapFactory.Options options = new BitmapFactory.Options();
options.inPreferredConfig = Bitmap.Config.ARGB_8888;
Bitmap gradient = BitmapFactory.decodeResource(getResources(), R.drawable.secondbutton, options);
findViewById(R.id.imageView2).setBackgroundDrawable(new BitmapDrawable(gradient));
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_secondbutton, menu);
return true;
}
}
我尝试删除图像的一小部分(具有透明背景),但是没有结果. 谢谢.
I tried to erase a tiny part of my image(to have a transparent background) but without results. Thank you.
推荐答案
如何从Photoshop中保存图像? 透明png! 通过网络导出
How do you save the image from photoshop? Transparent png! With export for web
这篇关于低质量的图像android开发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!