從前幾天我試圖創建一個應用程序,可以根據模擬器的大小更改調整屏幕..我發現使用多個屏幕的解決方案。Android上的多屏幕支持
但我無法做到這一點 我已經從this接受了幫助,但無法理解我怎麼能setContentView(R.layout.main);
?因爲當我R
後,按。(點)不告訴我這個文件夾下面.. :( 我創建了res
文件夾下的layout-large
,layout-small
和layout-large-land
3個文件夾在我的Android應用程序
我已經添加到這一點我的清單文件..
<supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true" />
我是缺少在這裏什麼事?我在提前採用了android 1.6的感謝 的問題是我是否已經提供這main.xml
文件默認layout folder
也?是的話那麼在屏幕尺寸CHAGE沒有影響沒有那麼它關閉我的應用程序強制我已經使用API level 7
也不過問題試圖保持相同 這是我的xml文件
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:id="@+id/rl"
android:layout_height="360dip">
<!--
<WebView android:id="@+id/webviewHelp"
android:layout_width="fill_parent"
-->
<!-- android:layout_height="fill_parent" />-->
<WebView android:id="@+id/webviewHelp" android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<Button android:id="@+id/My_btn"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true" android:gravity="center"
android:textSize="8px" android:text="Download this mp3 file"
android:textColor="@color/white" android:layout_width="fill_parent"
android:layout_height="28dip" android:visibility="invisible" />
<Button android:id="@+id/My_btn1"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true" android:text="this is button !"
android:layout_width="0dip" android:layout_height="0dip"
android:visibility="invisible" />
</RelativeLayout>
的setContentView(R.layout.main)將是相同的。根據模擬器的大小,android會假定要考慮哪個文件夾。 – Lavanya 2011-06-13 05:31:14
它不會顯示任何文件夾名稱,但默認佈局,它不是你的頭痛,Android會自動選擇合適的文件夾 – ingsaurabh 2011-06-13 05:31:52
查看我更新的代碼 – Android 2011-06-13 06:11:34