【发布时间】:2014-12-16 12:38:11
【问题描述】:
我正在尝试定义多个 LinearLayout 以适应我的活动底部的表单和按钮栏,但它没有出现,在我更改之前,所有表单都使用 ScrollView,但我删除了它,因为我将不再使用,但是当我删除我的布局不再出现时,任何人有任何解决方案我做错了什么?还是忘了?
这是我的新代码,但是当我将方向转为横向时,我的按钮消失了。我该如何解决?
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusableInTouchMode="true"
android:orientation="vertical" >
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="vertical" >
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Cliente: "
android:textSize="18sp" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<br.com.stara.iris.mobile.tmp.DelayAutoCompleteTextView
android:id="@+id/nota_cliente"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="2"
android:imeOptions="flagNoExtractUi|actionSearch"
android:inputType="textCapSentences" />
<ProgressBar
android:id="@+id/nota_cliente_loading_indicator"
style="?android:attr/progressBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|end"
android:layout_marginEnd="@dimen/margin_default"
android:visibility="gone" />
</FrameLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Dados do Dispositivo: "
android:textSize="18sp" />
<Spinner
android:id="@+id/dadosdispo"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Número de Série: "
android:textSize="18sp" />
<EditText
android:id="@+id/nota_numeroserie"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:hint="Digite o n° serie"
android:maxLength="18" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Descrição: "
android:textSize="18sp" />
<EditText
android:id="@+id/nota_descricao"
android:layout_width="match_parent"
android:layout_height="120dp"
android:hint="Digite a descrição"
/>
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center|bottom"
android:orientation="horizontal" >
<Button
android:id="@+id/btn_nota_itenslist"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="3dp"
android:background="@drawable/button_selector"
android:text="Itens" />
<Button
android:id="@+id/btn_nota_ordenslist"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="3dp"
android:background="@drawable/button_selector"
android:text="Ordens" />
<Button
android:id="@+id/btn_nota_limpar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="3dp"
android:background="@drawable/button_selector"
android:text="Limpar" />
<Button
android:id="@+id/btn_nota_salvar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="3dp"
android:background="@drawable/button_selector"
android:text="Salvar" />
</LinearLayout>
</LinearLayout>
这就是我想要的,但是当切换横向模式时,我的按钮不会消失,我可以通过这种方式弄清楚但我不知道是否正确。
并带有标签android:gravity="center|bottom" 我希望在我的活动的last line 中设置这些栏按钮,最后一个小部件栏可以这样说,但我不知道如何?
另外,我怎样才能将按钮的大小分开以适应屏幕的大小?
【问题讨论】:
-
你能发一张你想要的照片吗?
-
当然刚刚更新...
-
你发布的xml是当前那个?
-
是的,我现在用的是这个,我需要解决更改屏幕尖/纵向 x 横向和按钮大小的问题
-
@TheRedFox 你有什么想法我能做什么???
标签: android android-layout android-linearlayout android-relativelayout android-framelayout