我要创建一个具有上最底部的极顶,4个按键6 TextViews布局,然后对整个中心的空间与22复选框(1元线)滚动视图。基本上我想要在上面,2个按钮标题栏在底部导航,和一个列表,我可以在中间通过滚动。
我也想复选框保持uncheckable,我敢肯定,是一个简单的函数调用。
该视图来了,没有上标题文本,并与按钮不低于吧。有谁知道该怎么办?滚动视图是唯一出现....
<?XML版本=1.0编码=UTF-8&GT?;< LinearLayout中的xmlns:机器人=http://schemas.android.com/apk/res/android机器人:layout_width =FILL_PARENT机器人:layout_height =FILL_PARENT机器人:方向=垂直机器人:weightSum =1.0> <的LinearLayout 机器人:layout_width =FILL_PARENT 机器人:layout_height =WRAP_CONTENT 机器人:layout_weight =1> <的TextView 机器人:layout_width =WRAP_CONTENT 机器人:layout_height =WRAP_CONTENT 机器人:重力=CENTER_HORIZONTAL 机器人:文字=SN:/> <的TextView 机器人:ID =@ + ID / serialNumberView 机器人:layout_width =WRAP_CONTENT 机器人:layout_height =WRAP_CONTENT 机器人:重力=CENTER_HORIZONTAL/> <的TextView 机器人:layout_width =WRAP_CONTENT 机器人:layout_height =WRAP_CONTENT 机器人:重力=CENTER_HORIZONTAL 机器人:文字=版本:/> <的TextView 机器人:ID =@ + ID / versionView 机器人:layout_width =WRAP_CONTENT 机器人:layout_height =WRAP_CONTENT 机器人:重力=CENTER_HORIZONTAL/> <的TextView 机器人:layout_width =WRAP_CONTENT 机器人:layout_height =WRAP_CONTENT 机器人:重力=CENTER_HORIZONTAL 机器人:文字=输入:/> <的TextView 机器人:ID =@ + ID /浮雕观看 机器人:layout_width =WRAP_CONTENT 机器人:layout_height =WRAP_CONTENT 机器人:重力=CENTER_HORIZONTAL/> < / LinearLayout中> <滚动型 机器人:layout_width =FILL_PARENT 机器人:layout_height =FILL_PARENT 机器人:layout_weight =1> <的LinearLayout 机器人:layout_width =WRAP_CONTENT 机器人:layout_height =WRAP_CONTENT 机器人:方向=垂直 机器人:layout_weight =1> <复选框 机器人:ID =@ + ID / floatCheck 机器人:layout_width =WRAP_CONTENT 机器人:layout_height =WRAP_CONTENT 机器人:文字=浮动/> <复选框 机器人:ID =@ + ID / tripCheck 机器人:layout_width =WRAP_CONTENT 机器人:layout_height =WRAP_CONTENT 机器人:文字=跳闸/> <复选框 机器人:ID =@ + ID / closeCheck 机器人:layout_width =WRAP_CONTENT 机器人:layout_height =WRAP_CONTENT 机器人:文字=关闭/> <复选框 机器人:ID =@ + ID / blockedCheck 机器人:layout_width =WRAP_CONTENT 机器人:layout_height =WRAP_CONTENT 机器人:文字=阻止/> <复选框 机器人:ID =@ + ID / hardTripCheck 机器人:layout_width =WRAP_CONTENT 机器人:layout_height =WRAP_CONTENT 机器人:文字=出行难/> <复选框 机器人:ID =@ + ID / phaseAngleCheck 机器人:layout_width =WRAP_CONTENT 机器人:layout_height =WRAP_CONTENT 机器人:文字=相角错收/> <复选框 机器人:ID =@ + ID / diffVoltsCheck 机器人:layout_width =WRAP_CONTENT 机器人:layout_height =WRAP_CONTENT 机器人:文字=差分伏过低/> <复选框 机器人:ID =@ + ID / networkVoltsCheck 机器人:layout_width =WRAP_CONTENT 机器人:layout_height =WRAP_CONTENT 机器人:文字=Netwrok伏太低关闭/> <复选框 机器人:ID =@ + ID / usingDefaultsCheck 机器人:layout_width =WRAP_CONTENT 机器人:layout_height =WRAP_CONTENT 机器人:文字=使用默认设置(重新编程)/> <复选框 机器人:ID =@ + ID / relaxedCloseActiveCheck 机器人:layout_width =WRAP_CONTENT 机器人:layout_height =WRAP_CONTENT 机器人:文字=松绑关闭主动/> <复选框 机器人:ID =@ + ID / commBoardDetectedCheck 机器人:layout_width =WRAP_CONTENT 机器人:layout_height =WRAP_CONTENT 机器人:文字=通讯局检出/> <复选框 机器人:ID =@ + ID / antiPumpBlock 机器人:layout_width =WRAP_CONTENT 机器人:layout_height =WRAP_CONTENT 机器人:文字=反泵座/> <复选框 机器人:ID =@ + ID / motorCutoffCheck 机器人:layout_width =WRAP_CONTENT 机器人:layout_height =WRAP_CONTENT 机器人:文字=电机截止禁止/> <复选框 机器人:ID =@ + ID / phaseRotationCheck 机器人:layout_width =WRAP_CONTENT 机器人:layout_height =WRAP_CONTENT 机器人:文字=相序错误/> <复选框 机器人:ID =@ + ID / usingDefaultDNPCheck 机器人:layout_width =WRAP_CONTENT 机器人:layout_height =WRAP_CONTENT 机器人:文字=使用默认DNP配置文件/> < / LinearLayout中> < /滚动型> <的LinearLayout 机器人:layout_width =FILL_PARENT 机器人:layout_height =WRAP_CONTENT 机器人:方向=横向 机器人:layout_weight =1> <按钮 机器人:ID =@ + ID /按钮3 机器人:layout_width =FILL_PARENT 机器人:layout_height =WRAP_CONTENT 机器人:文字=返回/> <按钮 机器人:ID =@ + ID /按钮3 机器人:layout_width =FILL_PARENT 机器人:layout_height =WRAP_CONTENT 机器人:文本=阅读/> < / LinearLayout中>< / LinearLayout中>
解决方案
试着做这样的事情:
的LinearLayout 的LinearLayout 页眉元素 /的LinearLayout 滚动型 的LinearLayout 主元素 /的LinearLayout /滚动型 的LinearLayout 底元素 /的LinearLayout/的LinearLayout
Remeber使用Android:如果你想要的元素apear对方下方的方向的LinearLayout =垂直
I want to create a layout that has 6 TextViews on the very top, 4 Buttons on the very bottom, and then have the entire center space be a scroll view with 22 Checkboxes ( 1 per line ). Basically I want a title bar on top, 2 buttons to navigate on the bottom, and a list I can scroll through in the middle.
I also would like the checkboxes to remain uncheckable, which I'm sure is a simple function call.
The view comes up with no upper title with text, and no lower bar with the buttons. Does anyone know what to do? The scrollview is the only thing appearing....
<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:weightSum="1.0" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="SN : " />
<TextView
android:id="@+id/serialNumberView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="Ver : " />
<TextView
android:id="@+id/versionView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="Type : " />
<TextView
android:id="@+id/typeView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal" />
</LinearLayout>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1">
<CheckBox
android:id="@+id/floatCheck"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Float" />
<CheckBox
android:id="@+id/tripCheck"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Trip" />
<CheckBox
android:id="@+id/closeCheck"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Close" />
<CheckBox
android:id="@+id/blockedCheck"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Blocked" />
<CheckBox
android:id="@+id/hardTripCheck"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hard Trip" />
<CheckBox
android:id="@+id/phaseAngleCheck"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Phase angle wrong for closing" />
<CheckBox
android:id="@+id/diffVoltsCheck"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Differential volts too low" />
<CheckBox
android:id="@+id/networkVoltsCheck"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Netwrok volts too low to close" />
<CheckBox
android:id="@+id/usingDefaultsCheck"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Using Defaults( Reprogram )" />
<CheckBox
android:id="@+id/relaxedCloseActiveCheck"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Relaxed Close Active" />
<CheckBox
android:id="@+id/commBoardDetectedCheck"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Comm Board Detected" />
<CheckBox
android:id="@+id/antiPumpBlock"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Anti-Pump Block" />
<CheckBox
android:id="@+id/motorCutoffCheck"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Motor Cutoff Inhibit" />
<CheckBox
android:id="@+id/phaseRotationCheck"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Phase Rotation Wrong" />
<CheckBox
android:id="@+id/usingDefaultDNPCheck"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text= "Using Default DNP Profile" />
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_weight="1" >
<Button
android:id="@+id/button3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Back" />
<Button
android:id="@+id/button3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Read" />
</LinearLayout>
</LinearLayout>
解决方案
Try doing something like this:
LinearLayout
LinearLayout
Header-Elements
/LinearLayout
ScrollView
LinearLayout
Main-Elements
/LinearLayout
/ScrollView
LinearLayout
Bottom-Elements
/LinearLayout
/LinearLayout
Remeber to use android:orientation="vertical" on the LinearLayout if you want that the elements apear beneath each other.