Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
Question about checkbox and gravity in layout
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Matt  
View profile  
 More options Jul 20 2009, 6:25 pm
From: Matt <reisc...@googlemail.com>
Date: Mon, 20 Jul 2009 15:25:27 -0700 (PDT)
Local: Mon, Jul 20 2009 6:25 pm
Subject: Question about checkbox and gravity in layout
Hi,

here I have a part of my layout, where I want to position a checkbox
to the right of the screen while it with two lines of text. I was
trying to mimic the look of the layout on the settings pages in the
emulator.
Here is the layout XML:

<LinearLayout
        android:orientation="horizontal"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:padding="4dp">
        <LinearLayout
                android:orientation="vertical"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:padding="2dp">
                <TextView
                        android:text="Use colored text"
                        android:textSize="18sp"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content">
                </TextView>
                <TextView
                        android:text="Check to output colored text"
                        android:textSize="12sp"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content">
                </TextView>
        </LinearLayout>
        <LinearLayout
                android:orientation="vertical"
                android:gravity="right"
                android:layout_gravity="right"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:padding="2dp">
                <CheckBox
                        android:id="@+id/check"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content">
                </CheckBox>
        </LinearLayout>
</LinearLayout>

Now this works fine, but I was wondering why I need to wrap the
checkbox in another LinearLayout to actually get it to stick to the
right side. If I would remove the LinearLayout that's wrapping the
checkbox, it wouldn't be at the right side of the screen, even if I
would put gravity="right" in the checkbox properties. Any idea why? Or
any suggestion on how to create this layout more efficiently? Thank in
advance!

Cheers, Matt


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »