我正在爲我的應用程序設計一個頁面,其中我使用了兩個圖像和幾個垂直文字瀏覽。但是,當我使用不同的分辨率在模擬器中啓動應用程序時,圖像會變形。我使用了9-patch.png,但發現它已從Android 3.0中棄用,如果我正在開發2.3和更高版本的應用程序,我可以使用它嗎?爲多種屏幕分辨率創建圖像
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:background="#FFFFFF" android:orientation="horizontal">
<LinearLayout android:id="@+id/linearLayout1" android:layout_width="wrap_content" android:layout_height="match_parent" android:orientation="vertical">
<ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:background="@drawable/auto" android:layout_height="wrap_content"></ImageView>
<LinearLayout android:id="@+id/linearLayout3" android:layout_width="match_parent" android:layout_height="wrap_content">
<TextView android:text="Home" android:textColor="#FF0000" android:id="@+id/textView8" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
<TextView android:text=">Products" android:textColor="#FF0000" android:id="@+id/textView7" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
</LinearLayout>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/textView3" android:text="Replacement Parts" android:textColor="#000000" ></TextView>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/textView2" android:text="Accessories" android:textColor="#000000" android:focusable="true" android:layout_gravity="left" android:cursorVisible="true" ></TextView>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/textView6" android:text="Tools Equipment" android:textColor="#000000" ></TextView>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/textView4" android:text="Fluids Chemicals" android:textColor="#000000" ></TextView>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/textView5" android:text="Performance" android:textColor="#000000" android:onClick="Perform" ></TextView>
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ImageView
android:id="@+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/test_9patch_patched" >
</ImageView>
</LinearLayout>
請讓我知道,如果有任何其他方式除了9 patch.png圖像...
有你嘗試使用權重?請確保您的圖像使用正確的比例類型... –
非常感謝各位... 我徹底檢查了api,它似乎9補丁不被棄用,但它讓我想到有無數的Android設備(手機)不同的屏幕尺寸。因此,根據不同的屏幕尺寸調整圖像的最佳做法是什麼? –