Как добавить нижний колонтитул в макет сетки в Android

Мне нужно добавить какое-то представление нижнего колонтитула в макет сетки в Android, для этого нет официальной документации, которую я могу найти, и я не смог найти метод, который действительно работает в моих поисках Google, кто-нибудь добился чего-либо как это? Мне нужно сделать кнопку, которая будет отображаться в нижней части сетки, чтобы я мог добавлять больше фотографий по клику, вроде приведенного ниже примера из instagram, любая помощь будет иметь большое значение, спасибо!

введите здесь описание изображения

<?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="wrap_content"
android:orientation="vertical" >

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:layout_margin="5dp" >

    <ImageView
        android:id="@+id/profile_user_avatar"
        android:layout_width="48px"
        android:layout_height="48px"
        android:adjustViewBounds="true"
        android:layout_marginTop="5dp" />

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" 
        android:paddingLeft="5dp">

        <TextView
            android:id="@+id/profile_realname"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="left"
            android:textSize="20dp"
            android:textStyle="bold"
             />

        <TextView
            android:id="@+id/profile_username"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="2dp"
            android:gravity="left" />
    </LinearLayout>
</LinearLayout>

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

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_margin="5dp"
        android:layout_weight="1"
        android:orientation="vertical" >

        <TextView
            android:id="@+id/tweets_stat"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:background="@color/button_color_light"
            android:gravity="center"
            android:padding="10dp"
            android:textSize="20dp"
            android:textStyle="bold"
            android:textColor="#FFFFFF" />

        <TextView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:background="@color/button_color_dark"
            android:gravity="center"
            android:padding="10dp"
            android:text="Tweets"
            android:textSize="15dp"
            android:textStyle="bold"
            android:textColor="#FFFFFF" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_margin="5dp"
        android:layout_weight="1"
        android:orientation="vertical" >

        <TextView
            android:id="@+id/followers_stat"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:background="@color/button_color_light"
            android:gravity="center"
            android:padding="10dp"
            android:textSize="20dp"
            android:textStyle="bold"
            android:textColor="#FFFFFF" />

        <TextView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:background="@color/button_color_dark"
            android:gravity="center"
            android:padding="10dp"
            android:text="Followers"
            android:textSize="15dp"
            android:textStyle="bold"
            android:textColor="#FFFFFF" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_margin="5dp"
        android:layout_weight="1"
        android:orientation="vertical" >

        <TextView
            android:id="@+id/following_stat"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:background="@color/button_color_light"
            android:gravity="center"
            android:padding="10dp"
            android:textSize="20dp"
            android:textStyle="bold"
            android:textColor="#FFFFFF" />

        <TextView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:background="@color/button_color_dark"
            android:gravity="center"
            android:padding="10dp"
            android:text="Following"
            android:textSize="15dp"
            android:textStyle="bold"
            android:textColor="#FFFFFF" />
    </LinearLayout>
</LinearLayout>

<GridView
    android:id="@+id/gridView1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:columnWidth="90dp"
    android:gravity="center"
    android:horizontalSpacing="10dp"
    android:numColumns="auto_fit"
    android:stretchMode="columnWidth"
    android:verticalSpacing="10dp" >
</GridView>

<Button
    android:id="@+id/profile_button"
    style="@style/TextAppearance.Button"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginBottom="30dp"
    android:layout_marginTop="30dp"
    android:background="@drawable/button_background"
    android:text="Load more photos" />
</LinearLayout>

person Edmund Rojas    schedule 19.06.2012    source источник
comment
Если вам просто нужен вид внизу сетки, это, безусловно, возможно. Можете ли вы опубликовать любой из ваших XML?   -  person Jared Burrows    schedule 20.06.2012
comment
@MasterJB Я разместил свой xml, на самом деле у меня есть кнопка, которая просто сидит там, но она исчезает сразу после завершения загрузки сетки.   -  person Edmund Rojas    schedule 20.06.2012
comment
Пробовали ли вы комментировать свой GridView и смотреть, что происходит? У меня была аналогичная проблема, когда я добавлял рекламу в свое приложение. Кроме того, попробуйте добавить свою кнопку в Linearlayout отдельно и принудительно расположите ее внизу. Вот как я решил свою проблему с моими объявлениями, потому что не все элементы загружались одновременно.   -  person Jared Burrows    schedule 20.06.2012


Ответы (1)


Вы можете эффективно добавить элемент сетки нижнего колонтитула, используя что-то вроде: https://github.com/commonsguy/cwac-endless

Это не будет похоже на то, что вам нужно, это будет больше похоже на то, что последний элемент сетки — это кнопка.

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

person akshaydashrath    schedule 19.06.2012