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