Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9104839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T01:57:24+00:00 2026-06-17T01:57:24+00:00

How to add button in footer below listview in layout with fragment. I have

  • 0

How to add button in footer below listview in layout with fragment.
I have code as below:

In fragment java.

ListView listview;
Button button;


public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.category, container, false);
        View footerView = inflater.inflate(R.layout.footer_category, null);
        listview = (ListView) view.findViewById(R.id.categoryNewsItemGrid);
        listview.addFooterView(footerView);

    loadmore = (Button) footerView.findViewById(R.id.loadMore);
    loadmore.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View arg0) {
            Log.d("Mylog","Button can click");
        }
    });

        return view;
}

/res/layout/category.xml

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

    <ListView
        android:id="@+id/categoryNewsItemGrid"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:divider="#C5C5C5"
        android:dividerHeight="2px" />

</LinearLayout>

/res/layout/footer_category.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/footerCategory"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">

    <Button
        android:id="@+id/loadMore"
        android:layout_width="fill_parent"
        android:text="Load More" />

</LinearLayout>

And i get error(Force Close), if i see in logcat, i get message error Android Runtime in line 74, line 74 is:

View footerView = inflater.inflate(R.layout.footer_category, null);

My question, i want to add button in footer, below listview. like as this screenshot.
thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T01:57:25+00:00Added an answer on June 17, 2026 at 1:57 am

    You missed layout_height in your /res/layout/footer_category.xml:

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/footerCategory"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content">
    
        <Button
            android:id="@+id/loadMore"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="Load More" />
    
    </LinearLayout>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm adding data using footer template and I have button to add. So when
I have add a view with button in UITableView Header . I have set
I want to add button to following header. It should have layout like http://www.fullstopinteractive.com/
I am using following code for add button with image on tool bar, but
In below link there is add button which allows you to ADD multiple textbox
I have two validation groups: parent and child I have an add button that
i am having a tableview with a list of categories.i have an add button
net website, I would like to add button by which user can view the
I've got a gridview that renders as a table. I have an Add button
I have a listview as below <?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=fill_parent android:orientation=horizontal

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.