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. Anyone noticing more uninstalls of their app than usual over last weekend/today?

I released an upgrade to my app on Saturday night and since have
noticed an unusual number of uninstalls. My app has been out for 8
months, and this is very unusual. Has anyone else noticed this? I'm
wondering if there is anything related to the market, or a new OS
version hitting, or contracts with one of the phones coming up?

Any thoughts would be very appreciated.

Thanks!

pawpaw17

-- 

2. File Upload - Get Bytes Uploaded

I have a function I am using to upload files.  How can I get the
number of bytes of the file that have been uploaded (transferred)?
Can I setup a timer that does this?  If so, what variable to I read to
get the number of bytes uploaded?  Here is my code:

========================================================================

String existingFileName = fileToUpload;
File uploadFile = new File(existingFileName);
FileInputStream fileInputStream = new FileInputStream(uploadFile);

// Set some special vars
String lineEnd = "\r\n";
String twoHyphens = "--";
String boundary = "*****";

// URL to upload to
URL connectURL = new URL("http://url/to/upload/script.php?
filename="+fileToUpload);

// connectURL is a URL object
conn = (HttpURLConnection)connectURL.openConnection();

// allow inputs
conn.setDoInput(true);

// allow outputs
conn.setDoOutput(true);

// don't use a cached copy
conn.setUseCaches(false);

// use a post method
conn.setRequestMethod("POST");

// set post headers
conn.setRequestProperty("Connection","Keep-Alive");
conn.setRequestProperty("Content-Type","multipart/form-
data;boundary="+boundary);

// open data output stream
DataOutputStream dos = new DataOutputStream(conn.getOutputStream());
dos.writeBytes(twoHyphens + boundary + lineEnd);
dos.writeBytes("Content-Disposition: form-data; name=\"uploadedfile
\";filename=\""+existingFileName +"\"" + lineEnd);
dos.writeBytes(lineEnd);

// create a buffer of maximum size
int bytesAvailable = fileInputStream.available();
int maxBufferSize = 1024;
int bufferSize = Math.min(bytesAvailable, maxBufferSize);
byte[] buffer = new byte[bufferSize];

// read file and write it into form...
bytesRead = fileInputStream.read(buffer, 0, bufferSize);
while (bytesRead > 0)
{
        // Upload file part(s)
        dos.write(buffer, 0, bufferSize);
        bytesAvailable = fileInputStream.available();
        bufferSize = Math.min(bytesAvailable, maxBufferSize);
        bytesRead = fileInputStream.read(buffer, 0, bufferSize);
}

// Send multipart form data necesssary after file data...
dos.writeBytes(lineEnd);
dos.writeBytes(twoHyphens + boundary + twoHyphens + lineEnd);

// Close streams
fileInputStream.close();
dos.flush();

InputStream is = conn.getInputStream();
int ch;

StringBuffer b =new StringBuffer();
while( ( ch = is.read() ) != -1 ) {
        b.append( (char)ch );
}

String s=b.toString();
dos.close();

-- 

3. Official Android Beta User Community

4. Display TextFile

5. Email ,Wifi settings

6. Active Sync support for android