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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T02:09:12+00:00 2026-06-14T02:09:12+00:00

currently i have: <TextView android:id=@+id/textView1 android:layout_width=wrap_content android:layout_height=wrap_content android:text=15:22:33 \nApr 13 1999 android:textColor=#FFFFFFFF android:textAppearance=?android:attr/textAppearanceSmall />

  • 0

currently i have:

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="15:22:33 \nApr 13 1999"
                        android:textColor="#FFFFFFFF" 

        android:textAppearance="?android:attr/textAppearanceSmall" />

    <TextView
        android:id="@+id/comment"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_margin="5dip"
        android:background="@drawable/incoming_message_buble"
        android:paddingLeft="10dip"
        android:text="Hello bubbles!"
        android:textColor="@android:color/primary_text_light" />

and it work fine.

here is adapter code:

public View getView(int position, View convertView, ViewGroup parent) {
    View row = convertView;
    if (row == null) {
        LayoutInflater inflater = (LayoutInflater) this.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        row = inflater.inflate(R.layout.activity_sms_row_layout, parent, false);
    }

    wrapper = (LinearLayout) row.findViewById(R.id.wrapper);

    OneComment coment = getItem(position);

    countryName = (TextView) row.findViewById(R.id.comment);

    countryName.setText(coment.comment);


    countryName.setBackgroundResource(coment.left ? R.drawable.incoming_message_buble : R.drawable.outgoing_message_buble);
    wrapper.setGravity(coment.left ? Gravity.LEFT : Gravity.RIGHT);

    return row;
}

i have to change order, for gravity left, i need shown textview comment first, and textView1 second
for gravity right, keep xml setting.

please advise.

  • 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-14T02:09:13+00:00Added an answer on June 14, 2026 at 2:09 am

    I suggest using multiple layouts rather than constantly reorganizing each row’s layout. Override these two methods:

    @Override
    public int getItemViewType(int position) {
        return getItem(position).left ? 0 : 1;
    }
    
    @Override
    public int getViewTypeCount() {
        return 2;
    }
    

    And modify your getView():

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        if(getItemViewType == 0) {
            // Use the left layout
        } else {
            // Use the right layout
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have a standard text view <TextView android:id=@+id/tvTaskDate android:layout_width=wrap_content android:layout_height=wrap_content android:layout_below=@+id/tvTaskName android:text=Date android:layout_marginRight=30dp
i have a textview and a Menu , the textview is currently showing at
I currently have an xml layout called quests.xml: <?xml version=1.0 encoding=utf-8?> <RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=fill_parent
I have a TextView in my android application that has a set width on
I am currently working on an android project where I want to have the
I have a TextView within a ScrollView, which currently scrolls to the bottom of
I have this layout that works correctly, a relative layout with a text view
Currently have a drop down menu that is activated on a hover (from display:none
Currently have password protection on my main and sub directories, however I'd like to
I currently have a XSLT 2.0 Stylesheet that I am trying to remove empty

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.