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 7039043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:44:57+00:00 2026-05-28T01:44:57+00:00

i am working on an Android app that needs showing a list[table], inside the

  • 0

i am working on an Android app that needs showing a list[table], inside the layout[view]

I come from iPhone dev objC land, and i have an app that shows a table[list] inside the view[layout]

list/table

So how to show a list inside my layout, and place it to specified location [center],

ps. I havent found a list in the graphical layout editor of the xml, where is the list[table]?
2. I have done some tests with list views, but is a view, that replace the xml view, i want it inside my xml,,

thanks a lot!

  • 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-28T01:44:57+00:00Added an answer on May 28, 2026 at 1:44 am

    Yes, of course, you can do that

    1) you need to have listholder.xml here, you can scratch anything in you layout view, either imageview, textview..etc. just don’t forget to add ListView inside it. for example:

    <LinearLayout 
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/head_logo_bg">
    </LinearLayout>
    <LinearLayout 
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/background_label">
        <TextView
            android:id="@+id/city_txt" 
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:gravity="center_horizontal"
            android:layout_gravity="center"
            android:text="Sydney"
            android:textStyle="bold"
            android:textSize="17sp"/>
    </LinearLayout>
    <LinearLayout 
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:padding="40sp">
    
        <ListView 
        android:id="@android:id/list"
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:layout_centerVertical="true"
        android:scrollingCache="false"/>
    </LinearLayout>
    

    2) For custom your own list item, you have to create listitem.xml i.e.

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/listitemone"
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:padding="10sp">
    
        <LinearLayout 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:orientation="vertical">
                <ImageView android:id="@+id/user_image"
                    android:layout_width="80px" android:layout_height="80px"
                    android:layout_alignParentLeft="true"
                    android:layout_marginRight="5px"
                    android:src="@drawable/icon"
                    />
        </LinearLayout>
        <RelativeLayout 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:layout_marginLeft="5sp"
            android:orientation="vertical">
                <TextView
                    android:id="@+id/date_label"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/date"
                    android:textStyle="bold"
                android:textSize="16sp" />
                <TextView
                    android:id="@+id/date_value"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentRight="true"
                    android:layout_alignBaseline="@id/date_label"
                    android:layout_marginRight="20sp"
                    android:textColor="#FFF"
                    android:text="MM/dd/YYYY"
                    android:textStyle="bold"
                android:textSize="16sp" />
          </RelativeLayout>
    </LinerLayout>
    

    3) create customAdapter in your activity, it would look like this;

    public class MyListActivity extends ListActivity {
    
    private ArrayList<Yourdata> yourdata = new ArrayList<Youdata>();
            @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.listholder);    
                   // yourdata might be array, arraylist etc. 
    
                   MyCustomAdapter listadapter = new MyCustomAdapter(this, R.layout.listitem, yourdata);
    
              setListAdapter(listadapter);
    }
    
    private class MyCustomAdapter extends ArrayAdapter<Yourdata>{
                    //this case, i use Yourdata as type
            private ArrayList<Yourdata> items;
    
            public PreviousAdapter(Context context, int textViewResourceId,
                    ArrayList<Yourdata> items) {
                super(context, textViewResourceId, items);
                this.items = items;
            }
    
            @Override
            public View getView(int position, View convertView, ViewGroup parent) {
                View v = convertView;
                if(v == null) {
                    LayoutInflater vi = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                    v = vi.inflate(R.layout.listitem, null);
                }
                Yourdata yt = items.get(position);
                if(yt != null){
                 // Don't forget to use v.findView...., otherwise, it might force close when run app.
                    TextView dateStr = (TextView)v.findViewById(R.id.date_value);
    
                        dateStr.setText(yt.getDate());
                }   
                return v;
            }
    
    
    
          }
    
    
    }
    

    P.S. the above code might not exactly right… just give you an idea 🙂
    Here is a source about custom list (you might have seen it) hope it useful

    http://www.vogella.de/articles/AndroidListView/article.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on an Android app that needs to be able to display information
I'm writing an app for android that needs to parse data from an XML
I'm working on an Android app that needs a lot of API calls. I've
I am currently working on an Android App that needs several overlapping SurfaceViews in
I am working on an Android app that utilizes the Google Maps API MapView,
I am working on an Android app that has multiple screens the user will
We're designing an Android app that has several activities which are working in a
I'm an Android newbie, and working on an app which needs an Options menu.
I'm working on a Honeycomb app that needs a SearchView in the Actionbar, but
I've been working on a Android app that posts workouts to Dailymile.com. To authorise

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.