File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Android and the fly likes Layout issues Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark "Layout issues" Watch "Layout issues" New topic

Layout issues

John Kwest

Joined: Feb 16, 2011
Posts: 8
Hi everyone, i need a little help here.

My issue is that I have a layout that requires 5 buttons on the side that will be set to which values to look at. I have gotten the 5 buttons to align up and down just like I want, and have a new linear layout to the right with a text view that will be redrawn many times to show data. The problem is that every redraw of the text view creates 5 buttons inside of it....

Note, i have also tried this with tablelayout

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android=""
android:layout_width="fill_parent" androidrientation="horizontal" android:baselineAligned="false" android:layout_height="fill_parent">
<LinearLayout android:id="@+id/linearLayout1" android:layout_height="match_parent" android:layout_width="wrap_content" androidrientation="vertical">
<Button android:text="Button" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
<Button android:text="Button" android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
<Button android:text="Button" android:id="@+id/button3" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
<Button android:text="Button" android:id="@+id/button4" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
<TextView android:text="TextView" android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/job_text"></TextView>

Pratik Goswami
Ranch Hand

Joined: Mar 02, 2009
Posts: 136

Hi, John.
Can you post a snapshot of what you exactly want. I feel that there is everything okay with Layout XML.
The problem is that every redraw of the text view creates 5 buttons inside of it....

I didn't understand what does it mean ?

Pratik Goswami

iOS * Android Developer
Peter Johnson

Joined: May 14, 2008
Posts: 5852

Are you using an Adapter? Have you implemented Adapter.getView()? If so, what is the code in that method?

JBoss In Action
It is sorta covered in the JavaRanch Style Guide.
subject: Layout issues
It's not a secret anymore!