活動の 1 つに入れたい 480x2500 のフォトショップ画像を作成しました。しかし、.apk をインストールすると、画像の品質が低下します。グーグルで見つけたすべてを実際に試しましたが、結果はありませんでした。私は経験豊富なプログラマーではないので、時間をかけて、私を助けることができるすべてを説明してください. ここに私のコードがあります:
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;
}
}
画像のごく一部を(背景を透明にするために)消去しようとしましたが、結果はありませんでした。ありがとうございました。