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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:41:02+00:00 2026-05-31T20:41:02+00:00

I have created an ExpandableListView with the following code: <ExpandableListView android:id=@+id/android:list android:layout_width=wrap_content android:layout_height=0dp android:layout_marginTop=5dp

  • 0

I have created an ExpandableListView with the following code:

<ExpandableListView
    android:id="@+id/android:list"
    android:layout_width="wrap_content"
    android:layout_height="0dp"
    android:layout_marginTop="5dp"
    android:layout_weight="1"
    android:cacheColorHint="#00000000" /> <!-- This last line fixes a bug with a black background when scrolling through the list -->

The xml that defines the parent row is:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >

<TextView
    android:id="@+id/childname"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginLeft="40dp"
    android:textSize="20sp" />

</LinearLayout>

And finally, the xml that defines the child row is:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="1" >

<TextView
    android:id="@+id/childname"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_marginLeft="60dp"
    android:layout_weight="0.80"
    android:focusable="false"
    android:textSize="14sp" />

<CheckBox
    android:id="@+id/check1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="right"
    android:layout_weight="0.2"
    android:focusable="false" />

</LinearLayout>

What I am trying to accomplish is to have the CheckBox to the very right of the screen.
During design time, in eclipse, the element is actually to the right. But when I install it in my phone, it is not.

Here is the screenshot of the result: http://img444.imageshack.us/img444/584/97598265.png

Any ideas what might be wrong?

Regards,
Felipe

UPDATE
Following recommendation, this is what I did to have it working:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal" >

<TextView
    android:id="@+id/childname"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginLeft="60dp"
    android:focusable="false"
    android:layout_centerVertical="true"
    android:textSize="14sp" />

<CheckBox
    android:id="@+id/check1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_centerVertical="true"
    android:focusable="false" />
</RelativeLayout>
  • 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-31T20:41:03+00:00Added an answer on May 31, 2026 at 8:41 pm

    Use a relativeLayout for proper alignment

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:weightSum="1" >
    
    <TextView
    android:id="@+id/childname"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_marginLeft="60dp"
    android:layout_weight="0.80"
    android:focusable="false"
    android:textSize="14sp" />
    
    <CheckBox
    android:id="@+id/check1"
    android:layout_alignParentRight="true"
    android:layout_alignBottom="@id/childname"
    android:layout_toRightOf="@id/childname"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="right"
    android:layout_weight="0.2"
    android:focusable="false" />
    

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

Sidebar

Related Questions

I have the following problem: I would like to change value of ExpandableListView's cell
I have created a list. And I need to get the text on the
Have created a new property list, and deleted the original .plist (same filename). Deleted
I have an AlertDialog populated by an ExpandableListView. The list itself works perfectly, but
I have this code for an expandable list, I want to have a checkbox
I have created this Fiddle with this code: This is my problem I want
I have created a MazeSolver android app for a school project. I am using
Have created a c++ implementation of the Hough transform for detecting lines in images.
I have created a template for Visual Studio 2008 and it currently shows up
I have created a custom dialog for Visual Studio Setup Project using the steps

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.