2013-03-18 178 views
0

我有一個屏幕,一些ImageButton的,它會在手機很好,但我想他們片劑。使用9補丁的ImageButton大

所以,我想9補丁,但我不知道如何使用button.9.png。

我創建LDPI,MDPI,華電國際和xhdpi的圖像,所有的人都name.9.dpi

我怎麼能「告訴」德應用調整大小取決於屏幕尺寸?

這是我的佈局:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:orientation="vertical" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:gravity="center" 
android:background="@drawable/background" 
> 

<ImageButton 
    android:id="@+id/account_but" 
    android:background="@null" 
    android:contentDescription="@string/accountDesc" 
    android:layout_marginTop="50dip" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:src="@drawable/boton_usos" /> 

<ImageButton 
    android:id="@+id/alquilar_but" 
    android:background="@null" 
    android:contentDescription="@string/alquilarDesc" 
    android:layout_marginTop="5dip" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:src="@drawable/boton_alquilar" /> 


<ImageButton 
    android:id="@+id/paradas_but" 
    android:background="@null" 
    android:contentDescription="@string/paradasDesc" 
    android:layout_marginTop="5dip" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:src="@drawable/boton_paradas" /> 

<ImageButton 
    android:id="@+id/noticias_but" 
    android:background="@null" 
    android:contentDescription="@string/noticiasDesc" 
    android:layout_marginTop="5dip" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:src="@drawable/boton_noticias" /> 

<ImageButton 
    android:id="@+id/incidencia_but" 
    android:background="@null" 
    android:contentDescription="@string/incidenciaDesc" 
    android:layout_marginTop="5dip" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:src="@drawable/boton_incidencia" /> 

<ImageButton 
    android:id="@+id/informacion_but" 
    android:background="@null" 
    android:contentDescription="@string/infoDesc" 
    android:layout_marginTop="5dip" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:src="@drawable/boton_informacion" /> 


<ImageButton 
     android:id="@+id/banner_but" 
     android:background="@null" 
     android:contentDescription="@string/infoDesc" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="10dip" 
     android:src="@drawable/banner" /> 

</LinearLayout> 

回答

0

請看this廣泛。它會解釋你想要對你的圖像和不同的dpi文件夾做什麼。

9補丁用於拉伸居多,因此你不需要它是針對不同密度。他們通常都是甚至會延伸到佔用更大的若干意見的背景和索馬里紅新月會非常小的圖像。

+0

我怕你不明白我的問題,我有dpi的文件夾,並在所有密度移動工作完美,但問題是與平板電腦,它的華電國際,但它的大屏幕 – user1256477 2013-03-19 07:18:54