2017-01-21 2 views
0

Мой XML прокручивать макет (работа в процессе) выглядит следующим образом:Android прокруткой макет - вид не видно на изменения ориентации

<?xml version="1.0" encoding="utf-8"?> 
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:fillViewport="true"> 
<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:orientation="vertical" > 

    <ListView 
     android:id="@+id/list" 
     android:layout_height="wrap_content" 
     android:layout_width="match_parent" 
     > 
    </ListView> 
    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:orientation="horizontal"> 

     <TextView 
      android:id="@+id/tvStatus" 
      android:text="0 SMS found" 
      android:textSize="15sp" 
      android:layout_width="120dp" 
      android:layout_height="wrap_content" /> 
     <Button 
      android:id="@+id/btnExport" 
      android:layout_width="88dp" 
      android:layout_height="wrap_content" 
      android:text="Export" 
      /> 
    </LinearLayout> 
</LinearLayout> 
</ScrollView> 

Когда приложение нагрузки на испытательное устройство в портретном режиме, все точки зрения представлены и видно: portrait mode Когда ориентация устройства изменена на горизонтальную, видимая часть макета видна (?!?): landscape mode Кто-нибудь знает, что здесь происходит? Благодарю.

+0

Не делайте scrollview прямо из xml. make Linear layout и put scrollview в нем –

+0

Пробовал это, но это приводит к тому, что на экране видна только одна строка списка. – Gruiberg

ответ

0

Это расположение вам нужно:

<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:orientation="vertical"> 

    <ListView 
     android:id="@+id/list" 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:layout_weight="1"> 
    </ListView> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="horizontal"> 

     <TextView 
      android:id="@+id/tvStatus" 
      android:layout_width="120dp" 
      android:layout_height="wrap_content" 
      android:text="0 SMS found" 
      android:textSize="15sp"/> 

     <Button 
      android:id="@+id/btnExport" 
      android:layout_width="88dp" 
      android:layout_height="wrap_content" 
      android:text="Export" 
      /> 
    </LinearLayout> 

</LinearLayout> 

Вы можете также просмотреть, как будет макет быть в ландшафтном режиме при построении его:

enter image description here

+0

Это было очень быстро и эффективно! Спасибо, много человек, вы заставка :) – Gruiberg

0

, кажется, вам не хватает закрывающий тег просмотра прокрутки.

+0

Вы правы, я не вставлял его правильно, но он представлен в коде, так что это (было) не проблема. – Gruiberg

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