- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我的屏幕带有 ScrollView
和三个不同的 LinearLayouts
。
一个 LinearLayout
包含一个 Spinner
,第二个包含 ListView
,第三个包含两个 Buttons
(水平)。
我想显示一个屏幕,其中包含 3 个始终显示在屏幕底部的 LinearLayout
和 1 个始终显示在顶部的 LinearLayout
。在中间部分,我想显示 ListView
内容。这样整个屏幕上就没有空白。
我想为多个不同尺寸的设备创建屏幕。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/backrepeat"
android:orientation="vertical" >
<include
android:id="@+id/include1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
layout="@layout/actionbar" >
</include>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scrollbars="horizontal" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:padding="10dp" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight=".2"
android:background="@drawable/rounded_border"
android:orientation="vertical"
android:padding="15dp" >
<TextView
android:id="@+id/tvDiaryData"
style="@style/greenstyle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/heading"
android:gravity="center_horizontal"
android:text="@string/tvDiaryData" >
</TextView>
<TextView
android:layout_width="fill_parent"
android:layout_height="10dp"
android:gravity="center_horizontal" >
</TextView>
<Spinner
android:id="@+id/spDiaryAllBooking"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:prompt="@string/select_diaryallbooking" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1.6"
android:background="@drawable/layerlist"
android:orientation="vertical"
android:paddingBottom="5dp"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:paddingTop="5dp" >
<ListView
android:id="@+id/lvDiaryBooking"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:divider="#636466"
android:layout_weight="1"
android:dividerHeight="1dip"
android:scrollbarStyle="outsideOverlay"
android:scrollbarThumbVertical="@drawable/scrollbar_vertical_thumb" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight=".2"
android:background="@drawable/rounded_border"
android:orientation="horizontal"
android:padding="10dp" >
<Button
android:id="@+id/btnDiaryBook"
style="@style/greenButton"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:onClick="btnDiaryBook_Click"
android:text="@string/btnBook" >
</Button>
<Button
android:id="@+id/btnDiaryBalance"
style="@style/greenButton"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_marginLeft="10dp"
android:onClick="btnDiaryBalance_Click"
android:text="@string/btnDiaryBalance" >
</Button>
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
我想要的屏幕布局:
最佳答案
这是一个非常简单的解决方案。您应该能够在当前布局中使用它。
只需用您想要的内容填充 LinearLayouts
。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/ll1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" >
</LinearLayout>
<LinearLayout
android:id="@+id/ll2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" >
</LinearLayout>
<LinearLayout
android:id="@+id/ll3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" >
</LinearLayout>
</LinearLayout>
上面发布的代码的屏幕截图,颜色显示了不同的布局区域。
关于android - 如何将屏幕垂直分成三部分?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11988994/
简单问题:如何指定分割窗口中的字符数? C-x-3 将我的窗口均匀分割为两个窗口,但随后的分割会将其中一个窗口分成两半。我想要 3 个大小相同的 window 。文档说我应该能够指定左缓冲区的字符数作
我需要一个程序,可以接受用户输入的数据数量和长度(英尺和英寸或仅英寸),并将这些项目分为 40 组。 我最初尝试在 Excel 中完成此任务,但我不确定是否可以完成。 var cutList = [
这个问题已经有答案了: Why does the division of two integers return 0.0 in Java? [duplicate] (6 个回答) 已关闭 5 年前。
我想知道在使用布局 (MigLayout) 时我可以分成 2 行而不是两列吗? panel.add(fname,"split 2"); panel.add(Fname,"wrap, pushx, gr
我几乎有一个像下面这样的代码,我正在尝试添加 每 6 个结果之后。 echo ""; $query="SELECT * WHERE id='$id' ORDER BY date ASC"; $resu
我在 android 2.2 中创建了一个选项卡 fragment ,带有 android 兼容性支持库 ,现在在我的应用程序中我几乎没有 Activity ,其中一些是扩展 Activity 类和其
这是我的 question 的扩展. 为了让它更简单让我们假设我有一个 pandas 数据框,如下所示。 df = pd.DataFrame([[1.1, 1.1, 2.5, 2.6, 2.5, 3.
我正在开发 Windows Phone 8 应用程序,其中我有一个 Stackpanel,我想在其中放置 7 个矩形。我希望这些矩形具有相同的高度,无论屏幕尺寸如何。我尝试设置 Height="*"
我一直相信java使用UTF-16在内部对其字符进行编码。它使用 u+xxxx 的事实证实了这一点。表示字符代码的格式以及它使用 16 位存储 char 的事实。 . 但有时UTF-16需要超过 2
我正在开发 Windows Phone 8 应用程序,其中我有一个 Stackpanel,我想在其中放置 7 个矩形。我希望这些矩形具有相同的高度,无论屏幕尺寸如何。我尝试设置 Height="*"
为了重新编码 malloc 函数,我执行了 sbrk(stack) 其中: void *malloc(size_t size) { stack = 0; while (stack start
寻找一个 css 或 jquery 解决方案来将这些动态加载的表分解为每行最多 6 个,创建表的脚本将它们全部内联,有时一行中显示多达 32 个 td.tables。我怎样才能在最多只有 6 个内联显
我可以请求帮助将 UTF-16 数据流拆分成 block 吗? 不幸的是,很难找到字母边界。 任何帮助表示赞赏,已经花了几个晚上在这上面,很想了解这个问题。 运行良好的 Java 版本(是否有任何自动
我正在使用 Contact Forms 7在 wordpress 安装中创建联系表单。创建的表单位于 here Contact Form 扩展是免费、灵活且易于使用的。但问题是,无论一个表单包含多少个
我想将一个字符串拆分为一系列子字符串以适合我的数据库,假设我的数据库 varchar 大小为 50。如果将原始字符串切割为最多 50 个字符,那么我需要在该字符串中包含尾随 (逗号)。例如, 我的原始
我必须用 css 做一个足球队盾牌,我的想法是用球队的颜色做一个圆圈,我已经用 1 种或 2 种颜色为盾牌做了圆圈,但我在使用 3 种颜色的盾牌时遇到了麻烦 我将其用于 2 种颜色的防护罩 .equi
如果我有 1000 美元(可变),我想把这笔钱分给 20(可变)人,但不是平均地给每个人,我想给第一个人更多,然后第二人称等 所以第 20 个人得到的最少,第 5 个人得到的第 5 多。 我将如何实现
我需要一种算法,将数字 n 分成 k 部分,并增加限制,即每个分区元素必须在 a 0 and k > 0: for x in range(a, b+1): fo
这个问题在这里已经有了答案: 关闭 10 年前。 Possible Duplicate: Swing: How do I set a component height to the containe
很难说出这里要问什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或夸夸其谈,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开,visit the help center . 关闭 9
我是一名优秀的程序员,十分优秀!