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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:36:30+00:00 2026-06-10T08:36:30+00:00

Currently i am working in Android chat screen application, Using TabHost to set five

  • 0

Currently i am working in Android chat screen application, Using TabHost to set five tabs, then i have Used ListActivity to create ListView in my project, but the ListView show in full screen, i want to reduce height, because adding a EditText bottom of the screen, please help me.

Thanks in Advance

I tried this given below for your reference:

public class Texts extends ListActivity
{
     String[] data={"How may i help you?", "Please help me", "Item 3","Item 1", "Item 2", "Item 3","Item 1", "Item 2", "Item 3"};

    Drawable[] usrimg=null;
    String bgimg = "",_user="",_pass="";
    int odd_resID,even_resID;

     public void onCreate(Bundle savedInstanceState)
     {
            super.onCreate(savedInstanceState);
            System.out.println(" CHAT SCREEN ");

          //finding the list view
            ListView myList = getListView();
            myList.setAdapter(new MyCustomAdapter());
            myList.setCacheColorHint(0);

//          setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mListContent));
     }
     class MyCustomAdapter extends BaseAdapter
        {

            /**
             * returns the count of elements in the Array that is used to draw the text in rows 
             * @see android.widget.Adapter#getCount()
             */
            @Override
            public int getCount() 
            {
                return data.length; // data is nothing but the message length
            }

            /**
             * Get the data item associated with the specified position in the data set.
             * (not Implemented at this point)
             * @param position The position of the row that was clicked (0-n)
             * @see android.widget.Adapter#getItem(int)
             */
            @Override
            public String getItem(int position) 
            {
                // TODO Auto-generated method stub
                return null;
            }

            /**
             * Get the row id associated with the specified position in the list.
             * (not implemented at this point)
             * @param position The position of the row that was clicked (0-n)
             * @see android.widget.Adapter#getItemId(int)
             */
            @Override
            public long getItemId(int position) 
            {
                // TODO Auto-generated method stub
                return position;
            }

            /**
             * Returns the complete row that the System draws.
             * It is called every time the System needs to draw a new row;
             * You can control the appearance of each row inside this function.
             * @param position The position of the row that was clicked (0-n)
             * @param convertView The View object of the row that was last created. null if its the first row
             * @param parent The ViewGroup object of the parent view
             * @see android.widget.Adapter#getView(int, android.view.View, android.view.ViewGroup)
             */

            public View getView(int position, View convertView, ViewGroup parent) 
            {


                System.out.println("Enter here");


                LayoutInflater inflater = getLayoutInflater();//When you use a custom view in a ListView you must define the row layout.
                //You create an xml where you place android widgets and then in the adapter's code 
                View row;
                String even_color,odd_color;

//              SharedPreferences prefList = getSharedPreferences("PrefsFile",MODE_PRIVATE);
//              even_color = prefList.getString("even_bubble_color","pink");
//              odd_color = prefList.getString("odd_bubble_color","green");
//              
//              int even_color_id=getResources().getIdentifier(even_color,"drawable","com.teks.chilltwit"),
//                  odd_color_id=getResources().getIdentifier(odd_color,"drawable","com.teks.chilltwit");


                //ImageView even_view,odd_view;


                System.out.println("Timeline: Position: "+position+", Length: "+data.length);
//              if(position!=data.length-1){

                if(position%2==0)
                {
                    row = inflater.inflate(R.layout.list_row_layout_even, parent, false);
                    TextView textLabel = (TextView) row.findViewById(R.id.text);
                    textLabel.setText(data[position]);

                }
                else
                {
                    row = inflater.inflate(R.layout.list_row_layout_odd, parent, false);
                    TextView textLabel = (TextView) row.findViewById(R.id.text);
                    textLabel.setText(data[position]);
                }

                return (row);
            }
        }

enter image description here

  • 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-10T08:36:32+00:00Added an answer on June 10, 2026 at 8:36 am

    Try using fragments to divide your screen and accomplish what you want.

    • The top fragment contains the conversation in a ListView, like you have.

    • The bottom fragment contains the EditText, “Send” Button, etc.

    This way the user can scroll to any part of the conversation and be able to send a new message without having to scroll back down.

    Chat Fragment

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

Sidebar

Related Questions

Currently i ma working in Android application, Using TabHost to set Five tabs, then
Currently i am working in Android application, Using Tabbar to set five tabs, then
I'm currently working on an Android application. I wish to have a GridView on
Currently i am working in Android application, Using plist to store some values in
I am currently working on an Android Application in which XMPP is used for
Currently i am working in Android application, To create mail composer screen so i
Currently i am working in Android application, In iphone application Using presentModalViewController to animate
I am currently working on android project where I am using a custom list
I am currently working on android project where I want to have a text
I am currently working on an Android project. I am using a ListView and

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.