我做了一個我想放在我的活動中的一個photoshop圖像480x2500。 但是,安裝.apk後,圖像質量較差。我真的嘗試了我在google上發現的所有內容,但沒有結果。我不是一個有經驗的程序員,所以請花時間解釋一切可以幫助我的東西。 這裏是我的代碼:低質量圖像android開發
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;
}
}
我試圖抹掉我的形象的一小部分(有一個透明的背景),但沒有結果。 謝謝。
該行是錯誤的'機器人:layout_height = 「1166dp」' – Budius