0
我的應用程序由屏幕上的某些文本按鈕組成。它非常簡單,因爲這就是它所需要的。Android開發:構建我的應用程序以適應不同類型的智能手機
但是,當我在不同的虛擬電話測試我的應用程序,它看起來不同。現在,因爲我沒有使用圖像,我假設只要我的圖像位於可繪製文件夾中,而不是全部容納在不同的可繪製文件夾中,則它們不會成爲問題。
但我怎麼編寫的XML,以適應所有智能手機屏幕。
XML:
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:padding="@dimen/padding_medium"
android:text="@string/welsh_libs"
android:textColor="#FF0066"
android:textSize="30dip"
android:textStyle="bold"
tools:context=".WelshLibraries" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<Button
android:id="@+id/button2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="18dp"
android:background="#6088A1"
android:textColor="#FFFFFF"
android:text="@string/news" />
<Button
android:id="@+id/button3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="18dp"
android:background="#50C0E9"
android:textColor="#000000"
android:text="@string/find_lib" />
<Button
android:id="@+id/button4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="18dp"
android:background="#6088A1"
android:textColor="#FFFFFF"
android:text="@string/free_res" />
<Button
android:id="@+id/button5"
android:layout_width="285dp"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="18dp"
android:background="#50C0E9"
android:text="@string/ask_lib"
android:textColor="#000000" />
<Button
android:id="@+id/button6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="18dp"
android:background="#6088A1"
android:text="@string/find_book"
android:textColor="#FFFFFF" />
<Button
android:id="@+id/button7"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="18dp"
android:background="#50C0E9"
android:text="@string/register"
android:textColor="#000000" />
<Button
android:id="@+id/button8"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="18dp"
android:background="#6088A1"
android:text="@string/login"
android:textColor="#FFFFFF" />
</LinearLayout>
<ImageView
android:id="@+id/image1"
android:layout_width="190dp"
android:layout_height="0dip"
android:layout_marginBottom="5dp"
android:layout_marginLeft="70dp"
android:layout_weight="1"
android:contentDescription="@string/desc"
android:src="@drawable/waglogo"
android:visibility="visible" />
我使用DP的作爲計量單位,但我的理解是唯一可行的單位使用,所以我知道它不喜歡的設計與P-XS,EMS網站和%s可用。
任何幫助或人們可以提供的鏈接將不勝感激。 謝謝, 丹
附:如果我想在應用加載時在8位以下添加更多按鈕,我還在尋找一種向下滾動的方式。有任何想法嗎?