Android, перестать перекрывать элементы списка просмотра нижним колонтитулом страницы - PullRequest
2 голосов
/ 11 октября 2011

В моем Java-приложении для Android я использую просмотр списка для отображения загрузки информации из БД SQLite и нижнего колонтитула на этой странице.

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

Просто я хочу остановить наложение элементов списка в нижнем колонтитуле.

Может кто-нибудь помочь мне достичь этого, пожалуйста. Спасибо заранее.

Редактирование

<RelativeLayout android:id="@+id/relativeLayout1" android:layout_height="wrap_content" android:layout_width="match_parent">

    <ListView android:layout_width="match_parent"    
              android:layout_height="wrap_content" 
              android:id="@+id/companylistView"
              android:listSelector="@drawable/item_focus_bkg">
              </ListView>


    <LinearLayout android:id="@+id/linearLayout1" android:layout_height="wrap_content" android:layout_width="match_parent" android:orientation="vertical" android:layout_alignParentBottom="true" android:background="@android:color/darker_gray" >
        <TextView android:text="Footer Text" 
                  android:id="@+id/textView1" 
                  android:layout_width="wrap_content" 
                  android:layout_height="wrap_content" 
                  android:textColor="#000000" >
                  </TextView>       
    </LinearLayout>       


</RelativeLayout>

Ответы [ 2 ]

5 голосов
/ 11 октября 2011

Исходя из ваших требований (и поскольку вы не разместили здесь макет XML, который вы пробовали до сих пор), я предполагаю и могу предложить следующее:

  1. добавить нижнюю границу для вашего списка: android:layout_marginBottom="60dip"
  2. Если вы используете RelativeLayout, просто укажите listview как android:layout_above="@+id/footer"

Я предлагаю вам пойти со вторым вариантом.

Обновление:

Основываясь на опубликованном вами XML-коде, попробуйте следующий правильный формат XML:

<RelativeLayout 
    android:id="@+id/relativeLayout1" 
    android:layout_height="wrap_content" 
    android:layout_width="match_parent"
    xmlns:android="http://schemas.android.com/apk/res/android">

    <ListView android:layout_width="match_parent"    
              android:layout_height="match_parent" 
              android:id="@+id/companylistView"
              android:layout_above="@+id/textView1">
    </ListView>

    <TextView 
        android:text="Footer Text" 
        android:id="@+id/textView1"
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content"
        android:textColor="#000000" 
        android:layout_alignParentBottom="true">
    </TextView>       
</RelativeLayout>
0 голосов
/ 11 октября 2011

Вы должны использовать список нижний колонтитул, как это:

View footerView = ((LayoutInflater)getApplicationContext().getSystemService(getApplicationContext().LAYOUT_INFLATER_SERVICE)).inflate(R.layout.listview_footer, null, false);
list.addFooterView(footerView,null,false);

попробуйте это:

    <LinearLayout 
    android:id="@+id/linearLayout1" 
    android:layout_height="wrap_content" 
    android:layout_width="match_parent"
    android:orientation="vertical" >

    <ListView android:layout_width="match_parent"    
              android:layout_height="wrap_content" 
              android:id="@+id/companylistView"
              android:listSelector="@drawable/item_focus_bkg" />

    <RelativeLayout 
        android:id="@+id/relativeLayout1" 
        android:layout_height="wrap_content" 
        android:layout_width="match_parent"   
        android:background="@android:color/darker_gray" >

        <TextView 
            android:text="Footer Text" 
            android:id="@+id/textView1" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" 
            android:textColor="#000000" 
            android:layout_alignParentBottom="true" />

    </RelativeLayout>       

</LinearLayout>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...