0

Я пытаюсь определить несколько LinearLayout, чтобы они соответствовали форме и панели кнопок в нижней части моей активности, но она не появляется, прежде чем мои изменения все формы были с ScrollView, но я удалил это потому что я больше не буду использовать, но когда я удалил свой макет, больше не появляется, у кого-то есть какие-то решения, что я сделал неправильно? или забыть?Макеты Descendents не отображаются

Вот мой новый код, но когда я поворачиваю ориентацию к пейзажу, мои кнопки исчезают. как я могу это исправить?

<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> 

и вот его то, что я хочу, но когда получается режим альбомной мои кнопки не исчезают, и я мог понять, таким образом, но я не знаю, правильно или нет.

enter image description here

и с тегом android:gravity="center|bottom" Я хочу, чтобы установить эти кнопки бар в last line моей деятельности последний виджет бар позволяет сказать, что эти пути, но я не выяснить, каким образом?

А также как я могу разделить на равные размеры кнопок, чтобы они соответствовали размеру экрана?

+0

может у отправить картину, что у хочу? – kId

+0

От курса только что обновлено ... –

+0

xml, который вы разместили, является текущим? – TheRedFox

ответ

1

необходимо изменить только layout_height к 0dp из ScrollView применять вес 1 не 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="0dp" 
     android:layout_weight="1" > 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      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="0dp" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:layout_margin="3dp" 
      android:background="@drawable/button_selector" 
      android:text="Itens" /> 

     <Button 
      android:id="@+id/btn_nota_ordenslist" 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:layout_margin="3dp" 
      android:background="@drawable/button_selector" 
      android:text="Ordens" /> 

     <Button 
      android:id="@+id/btn_nota_limpar" 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:layout_margin="3dp" 
      android:background="@drawable/button_selector" 
      android:text="Limpar" /> 

     <Button 
      android:id="@+id/btn_nota_salvar" 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:layout_margin="3dp" 
      android:background="@drawable/button_selector" 
      android:text="Salvar" /> 
    </LinearLayout> 
</LinearLayout> 
+0

О, спасибо большое, человек, он работает, и с этим xml я заполняю фрагмент, и на самом деле, когда мое приложение запускается, начинайте в портретном режиме, но если вы измените перспективу моего краха приложения, у вас есть идея, почему это происходит? –

1
Try Relative Layout. 

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@+id/RelativeLayout1" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:focusableInTouchMode="true" 
android:orientation="vertical" > 

<ScrollView 
    android:id="@+id/ScrollView1" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_above="@+id/linear" 
    android:layout_alignParentLeft="true" 
    android:layout_alignParentTop="true" > 

    <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:id="@+id/linear" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" 
    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> 

</RelativeLayout> 
+0

О, спасибо большое, человек, он работает, и с этим xml я заселяю фрагмент, и на самом деле, когда мое приложение запускается, начинайте в портретном режиме, но если измените перспективу моего краха приложения, у вас есть идея, почему это происходит? –

Смежные вопросы