Spacing between elements in LinearLayout

by Rohit » Fri, 06 Mar 2009 07:14:26 GMT


Sponsored Links
 How do I reduce the spacing between the elements in a linear layout?
I tried to set the padding to 0 as well as the vertical spacing but
that didnt seem to help. I want the textview and the imageview to be
flush together with no space between them. The following is my XML
layout file but I dont acheive what I want with it.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android=" http://schemas.android.com/apk/res/ 
android"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:padding="0px"
        android:verticalSpacing="0px"
        android:gravity="center"
        >

        <ImageView android:id="@+id/imageid"
                           android:layout_width="107px"
                           android:layout_height="100px"
                           android:gravity="center"
                           android:padding="0px"
                           android:verticalSpacing="0px"
                           />

        <TextView android:id="@+id/textid"
                          android:layout_width="107px"
                          android:layout_height="25px"
                          android:background="#c3c3c3"
                          android:textColor="#000000"
                          android:shadowColor="#ffffff"
                          android:shadowRadius="3"
                          android:gravity="center"
                          android:padding="0px"
                         android:verticalSpacing="0px"
                      />

</LinearLayout>


--~--~---------~--~----~------------~-------~--~----~



Spacing between elements in LinearLayout

by Rohit » Fri, 06 Mar 2009 07:15:51 GMT


 Somehow the shadow on the text also doesnt show up..

Rohit




--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Spacing between elements in LinearLayout

by Rohit » Fri, 06 Mar 2009 07:30:37 GMT


 This works - I was making some mistake in my code. The shadow still
doesnt work

Rohit





--~--~---------~--~----~------------~-------~--~----~



Spacing between elements in LinearLayout

by Rohit Mordani » Sat, 07 Mar 2009 10:59:55 GMT


 How do I reduce the spacing between the elements in a linear layout?
I tried to set the padding to 0 as well as the vertical spacing but
that didnt seem to help. I want the textview and the imageview to be
flush together with no space between them. The following is my XML
layout file but I dont acheive what I want with it.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android=" http://schemas.android.com/apk/res/ 
android"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:padding="0px"
        android:verticalSpacing="0px"
        android:gravity="center"
        >

        <ImageView android:id="@+id/imageid"
                           android:layout_width="107px"
                           android:layout_height="100px"
                           android:gravity="center"
                           android:padding="0px"
                           android:verticalSpacing="0px"
                           />

        <TextView android:id="@+id/textid"
                          android:layout_width="107px"
                          android:layout_height="25px"
                          android:background="#c3c3c3"
                          android:textColor="#000000"
                          android:shadowColor="#ffffff"
                          android:shadowRadius="3"
                          android:gravity="center"
                          android:padding="0px"
                         android:verticalSpacing="0px"
                      />

</LinearLayout>


--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. id specify

It looks like our notepad tutorial is a little rusty.

<ListView android:id="@+id/list" ... />

Is what you want.

Cheers,
Justin
Android Team @ Google



--~--~---------~--~----~------------~-------~--~----~

2. Listview with different rows (layouts)

Hey,

I want to make a listview that has different rows (layouts). I will
load the data from a webservice and it can be 2 or more layouts i have
to generate then. I am creating a social network app and want to show
a stream of the users activity.
So when he made a comment, make a new friend, this all has to come in
the same list.. I load 1 XML file with multiple different child
objects (comment, friend) so i can see which layout i have to use.

I have saw this at the Brightkite android app:

http://www.grabup.com/uploads/c278f22e9bd19a2ccac2246ebd85326c.png?direct

user checked in, posted note --> different rows..

But I don't know how to do that.. I use a custom adapter for my
listview but i only can choose one row layout for my list..

Please help me!
Thank Wouter
--~--~---------~--~----~------------~-------~--~----~

3. How to run the latest version of Android

4. IOException while reading a raw resource.

5. Any way to transfer Android ID from App environment to Browser on Android phone

6. view.draw() at horizontal offset?

7. Very basic questions about porting and my linux based phone.