linearlayout

How to split the screen with two equal LinearLayouts?

Wanna to split a screen for my app with two LinearLayouts. What parameters should I use to make exact splitting in two equal parts - first LinearLayout on the top and the second one is just under it. ...

Trouble padding

Hi, I have a horizontal LinearLayout. This LinearLayout has a checkbox next to another LinearLayout. The layout width/height of the checkbox is wrap_content, whereas the inner LinearLayout is fill_parent/wrap_content. The layout_weight of the inner LinearLayout is set to 1. I've tried to add some android:padding around the checkbox ...

is it possible to evenly distribute buttons across the width of an android linearlayout

I have a linear layout (oriented horizontally) that contains 3 buttons. I want the 3 buttons to have a fixed width and be evenly distributed across the width of the linear layout. I can manage this by setting the gravity of the linearlayout to center and then adjusting the padding of the buttons, but this works for a fixed width and wo...

Custom Widget using LinearLayout not getting onDraw()

I'm creating a custom widget by extending LinearLayout: public class MyWidget extends LinearLayout { private static Paint PAINT = new Paint(Paint.ANTI_ALIAS_FLAG); static { PAINT.setColor(Color.RED); } public MyWidget(Context context) { this(context, null); } public MyWidget(Context context, Att...

ListView vs LinearLayout

Hi, I'm writing a horizontal tv-view, similar to the ones you know form tivo systems and similar. For each channel there is a row with the programmes for the next 6 hours or so, with a width proportional with their play time. My Idea is to write a custom widget for each row, and stack these on top of each other. This should allow me to ...

Place a RelativeLayout at the bottom of a Relative layout, Android

I have a RelativeLayout, and this Layout has two childs, one is a MapView and the other a RelativeLayout that contains a button. I want it to look like that http://pocketjourney.files.wordpress.com/2008/03/goal.gif but my transparent box (a relativelayout) is always displayed at the top of the map. <RelativeLayout android:layout_wi...

how can i automatically size listview so it doesn't scroll

currently i have the following layout <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentRight="true" android:layout_marginTop="9px" android:layout_below="@+id/desc" android:id="@+id/ll_item" andro...

TextView inside LinearLayout stretches the LinearLayout and fill_parent fix causes weight flip

If I have 2 LinearLayouts split %50/%50 everything is fine. Weights are 1 and 1. As soon as I add a TextView inside the top LinearLayout, it stretches that layout. I use "wrap_content" as the documentation says I should when it comes to weights. As you can see the red and green should be split evenly and text on grey background should...

float animated ImageView on top of other elements within LinearLayout - android

I have an extended ImageView that I'm reusing 7 times horizontally (within a LinearLayout) across my screen. Directly above and below this ImageView are other extended ImageViews that are within their own LinearLayouts. I'm spacing these all evenly by using the weight property within the LinearLayout so they space evenly across the scr...

Want to change LinearLayout layout at runtime

I've been searching, but can't find a way to do this. I want the ability to re-arrange Views in a LinearLayout, without specifying specific pixel locations, at runtime. for my proof of concept, I have a layout with 2 TextViews, one red, and one black. The red TextView is on the left. I want onClick to set it to be on the right, witho...

How to place textview on right and left of layout?

I want to place a textview on the right of a layout and on the left of a layout, but they keep stacking ontop of each other: <LinearLayout android:layout_width="0dip" android:layout_weight="1" android:layout_height="fill_parent" android:orientation="horizontal"> <TextView android:id="@+id/left...

Relative stacking with Linear Layout in Android?

I have 6 images I want to display as 2 rows with 3 images in each. I'm using nested LinearLayouts to achieve this, and it works well except for one thing: The height of the largest image dictates the size of the linear layout, meaning there is empty space a lot of the time. In other words, my problem is as follows: I keep getting the ...

LinearLayout height in onCreate is 0

Hello, I'm trying to dynamically adjust the height of my rows depending on the (screen height - my layout height) / list.size. Unfortunately in the OnCreate method the layout height returns null (not so when i call it in an on click listener). Is there another method I can call it in? TIA ...

different behaviour creating layout using xml / java

hello, I am trying to reproduce the behaviour of this simple layout : <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#0000ff"/> a linearlayo...

Android: can't remove vertical gap between images in LinearLayout

I have a simple LinearLayout in Android with two images vertically: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res/com.eataly.android" android:orientation="vertical" android:background="@android:color/white" androi...

LinearLayout OnClickListener not responding

I'm creating a custom widget by expanding LinearLayout. One of the elements in my custom widget is a linear layout, inflated from another layout. When I set the OnClickListener it is not responding. Can you please advise? Thanks! ...

Can I set a contentView inside of a ViewFlipper?

I have a ViewFlipper that contains Layouts. Is there a way I can hook up a Class to manage each layout seperately? Kind of like setContentView(R.layout.main); but I'm not sure how to reference the 3 different layouts in code. <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/an...

How do I calculate the required height of a GridView that is inside of a ScrollView on Android?

I have a GridView inside of a LinearLayout inside of a ScrollView that pages in data from the server. Beneath the GridView is a button to load more data. My GridView will have an ultimate height that is larger than the screen. If I set the height of my GridView to either wrap_content or parent_fill, it sizes itself to the exact available...

<TableLayout><TableRow><LinearLayout> hates me. Force close on run. Android.

Hi, all. I'm working on setting up a home screen layout for an Android app in which there is a 4x4 grid of launch icons. My current structure for this is like this: <TableLayout> <TableRow> <LinearLayout android:orientation="vertical"> <ImageButton> <TextView> </LinearLayout> </TableRow> ... ... ... </Tab...

Problems understanding Android XML layout_weight

Hi stackies, I really tried to, but I can't understand how Android interprets layout_weight setting... What I'm trying to archieve is a header on top with a fixed height an input area at the bottom containing an EditText and a Button a content part in the middle that's taking all what's left of space When typing I'd like to grow...