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

  • Home
  • SEARCH
  • 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 3724550
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T06:40:53+00:00 2026-05-19T06:40:53+00:00

I have a layout for a ListActivity. To modify the list I have used

  • 0

I have a layout for a ListActivity. To modify the list I have used menu-options. But to remove a couple of “clicks” on the screen I’d like to add two buttons in the button of the screen that is always visible and not affected if the list is scrolled.

My problem is that I don’t know how to add these buttons. I have tried a couple of solutions but the best I managed either the list or the buttons disapears from the layout. Seems that I can’t get both buttons and list visible at the same time.

So my question is how to create a layout where I can have both buttons and the list?

Thanks in advance
Roland

  • 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-05-19T06:40:54+00:00Added an answer on May 19, 2026 at 6:40 am

    From http://developer.android.com/reference/android/app/ListActivity.html:

    “ListActivity has a default layout that consists of a single, full-screen list in the center of the screen. However, if you desire, you can customize the screen layout by setting your own view layout with setContentView() in onCreate(). To do this, your own view MUST contain a ListView object with the id “@android:id/list””

    EDIT: here is an example:

    The ListActivity may be created like this:

    public class ListViewTest extends ListActivity {
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
    
            String[] values = {"One", "Two", "Three"};
    
            setListAdapter(new ArrayAdapter(this, android.R.layout.simple_list_item_1, values));
    
            setContentView(R.layout.main);
        }
    }
    

    The main.xml layout is as follows:

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">
    
        <ListView 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1" 
            android:id="@android:id/list"></ListView>
        <Button 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" 
            android:layout_gravity="center_horizontal"
            android:text="Test button" 
            android:id="@+id/TestButton"></Button>
    </LinearLayout>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a ListActivity whose layout looks like <?xml version=1.0 encoding=utf-8?> <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=fill_parent
I have a ListActivity where the list items are defined in another XML layout.
I have a layout that is working, but it has one very annoying problem..
I have a layout similar to this: <div id=...><img src=...></div> and would like to
I have a layout that creates a ListActivity. Before displaying the ListActivity, I perform
I have the following XML layout for a ListActivity. <?xml version=1.0 encoding=utf-8?> <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android
I have a ListActivity working as expected. When a list item is clicked the
I have a layout which uses min-width and works great. So I came to
I have the following layout for my test suite: TestSuite1.cmd: Run my program Check
I have a mockup layout for something here . Essentially there are sections, columns

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.