我試圖創建一個非常類似於Android 2.x上的本機日曆應用程序的「創建事件」窗體的窗體 基本上它有一個固定標題,固定頁腳和中間是(我猜)ScrollView
與不同的「問題」,如「事件」,「從」,「到」,「位置」等...Android:如何創建一個類似於日曆應用程序的佈局 - 創建活動
我試了幾選項,但我找不到正確的佈局,不涉及計算屏幕的高度
任何幫助將非常感謝!
我試圖創建一個非常類似於Android 2.x上的本機日曆應用程序的「創建事件」窗體的窗體 基本上它有一個固定標題,固定頁腳和中間是(我猜)ScrollView
與不同的「問題」,如「事件」,「從」,「到」,「位置」等...Android:如何創建一個類似於日曆應用程序的佈局 - 創建活動
我試了幾選項,但我找不到正確的佈局,不涉及計算屏幕的高度
任何幫助將非常感謝!
我使用的RelativeLayout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="@+id/status_header"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:paddingTop="8px"
android:paddingBottom="8px"
android:gravity="center"
android:textColor="@color/header_foreground"
android:background="@color/header_background"
android:text="@string/status_header"/>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/statuspanel"
android:layout_above="@+id/status_footer">
把所有中間位這裏,也許在TableLayout
</ScrollView>
<TableLayout
android:id="@+id/status_footer"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:paddingTop="4px"
android:paddingLeft="2px"
android:paddingRight="2px"
android:stretchColumns="*"
android:textColor="@color/footer_foreground"
android:background="@color/footer_background">
<TableRow>
<Button
android:id="@+id/status_backbutton"
android:layout_width="0px"
android:layout_weight="1"
android:text="@string/status_backbutton" />
</TableRow>
</TableLayout>
</RelativeLayout>
你必須原諒我所有的色彩位,但你的想法。 它是在RelativeLayout中使用alignParent元素,這是關鍵,我認爲
不應該使用'dp'而不是'px'嗎? – binnyb 2011-03-11 18:09:03
很可能。我不是真的瞭解所有這些都是誠實的。我正在設計我的應用程序至少爲320x480,並讓操作系統整理任何調整大小 – FrinkTheBrave 2011-03-12 07:43:41
感謝您的幫助,它的工作方式與我需要的完全一致。 我從我讀過的內容證實'dp'似乎比'px'更標準 – Johann 2011-03-14 08:54:46
你是什麼意思通過計算高度?如果它可以滾動,則不需要計算高度。 – 2011-03-11 17:02:49
同意,但後來在定位固定頁腳時遇到了問題 – Johann 2011-03-11 17:17:39