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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T09:12:15+00:00 2026-05-19T09:12:15+00:00

I want to create an interface that has one or two listviews that ultimately

  • 0

I want to create an interface that has one or two listviews that ultimately span the entire screen with two rows. How can I change their height so that they take up 50% of the screen, vertically?

If it’s along the same lines, I’d love to know how to do this regardless of orientation.

With regards to width; let us say I have two listviews, each with one row. They span the entire screen as described above. The lower listview has two clickable items within it that each take up 50% of the screen space, horizontally.

Is that possible? If so, how?

  • 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-19T09:12:15+00:00Added an answer on May 19, 2026 at 9:12 am

    Hi the following code will use full to create an interface that has one or two listviews that ultimately span the entire screen with two rows. The Java file is as follows,

    public class DoubleListView extends Activity {
        ListView listView,listView2;
        String[] titles = {"List 1 title1","List 1 title2","List 1 title3","List 1 title4","List 1 title5","List 1 title6","List 1 title7","List 1 title8","List 1 title9"};
        String[] titles2 = {"List 2 title1","List 2 title2","List 2 title3","List 2 title4","List 2 title5","List 2 title6","List 2 title7","List 2 title8","List 2 title9"};
        WindowManager wm;
    
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
    
            wm = (WindowManager)getSystemService(Context.WINDOW_SERVICE);
            int height = wm.getDefaultDisplay().getHeight();
    
            listView = new ListView(this);
            listView.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,height/2-15));
            listView.setAdapter(new CustomListAdapetr(this, titles));
    
            listView2 = new ListView(this);
            listView2.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,height/2));
            listView2.setAdapter(new CustomListAdapetr(this, titles2));
    
            ((LinearLayout)findViewById(R.id.mailLayout)).addView(listView);
            ((LinearLayout)findViewById(R.id.mailLayout)).addView(listView2);
    
        }
        public class CustomListAdapetr extends BaseAdapter{
    
            private Context mContext;
            private String[] list;
    
            public CustomListAdapetr(Context context, String[] titles) {
                mContext = context;
                list = titles;
            }
    
            @Override
            public int getCount() {
                // TODO Auto-generated method stub
                return list.length;
            }
    
            @Override
            public Object getItem(int position) {
                // TODO Auto-generated method stub
                return list[position];
            }
    
            @Override
            public long getItemId(int position) {
                // TODO Auto-generated method stub
                return position;
            }
    
            @Override
            public View getView(int position, View convertView, ViewGroup parent) {
                CustomView cv;
                if (convertView == null) {
                    cv = new CustomView(mContext,""+list[position]);
                    } 
                else {
                        cv = (CustomView) convertView;
    
                        cv.setTitle(list[position]);
    
                        }
                return cv;
            }
    
        }
    
        private class CustomView extends LinearLayout {
            public CustomView(Context context, String itemName) {
                super(context);
                this.setOrientation(HORIZONTAL);
                // Here we build the child views in code. They could also have
                // been specified in an XML file.
    
    
                mTitle = new TextView(context);
                mTitle.setText(itemName);
    
                mTitle.setTextSize(25);
    
                addView(mTitle, new LinearLayout.LayoutParams(200, LayoutParams.WRAP_CONTENT));
    
    
                }
            /**         * Convenience method to set the title of a SpeechView         */
            public void setTitle(String title) {
                mTitle.setText(title);
                }
            /**         * Convenience method to set the dialogue of a SpeechView         */
    
            private TextView mTitle;
    
            }
    
    }
    

    And the xml file is,

    <?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"
        android:id="@+id/mailLayout">
    
    </LinearLayout>
    

    Try this to get your desired interface.

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

Sidebar

Related Questions

I can't find IPasswordProvider interface in my WSE project. I want to create a
I'm trying to create a book type interface that has 'pages', and the user
I want to create a function that performs a function passed by parameter on
I want to create a simple http proxy server that does some very basic
i've got a problem with iPhone SDK. I want create an imageView that user
I want to create a customized submenu where i can add an about page
I want to create a sitemap page for Magento that will display all the
I want create a drop shadow around the canvas component in flex. Technically speaking
I want to create a Java application bundle for Mac without using Mac. According
I want to create a client side mail creator web page. I know the

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.