[Solved] Probleme with xml UI design

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

[Solved] Probleme with xml UI design

Postby bibiodp » Thu Dec 13, 2007 3:09 pm

Hello,

Here's the UI i'm trying to build :
-----------------
| A textview | //TextView
-----------------
------------- -------------
| Button1 | | Button2 | //2 Buttons
------------- -------------


And here's what I did in my layout file :
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1.  
  2. <?xml version="1.0" encoding="utf-8"?>
  3.  
  4. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  5.  
  6.    android:orientation="vertical"
  7.  
  8.    android:layout_width="fill_parent"
  9.  
  10.    android:layout_height="fill_parent">
  11.  
  12.    
  13.  
  14.         <TextView id="@+id/MyTV"
  15.  
  16.             android:layout_width="fill_parent"
  17.  
  18.             android:layout_height="wrap_content"
  19.  
  20.             android:text="Hello World, App" />
  21.  
  22.            
  23.  
  24.         <Button id="@+id/check_AppDB"
  25.  
  26.                 android:text="@string/checkAppDB"
  27.  
  28.                 android:layout_width="wrap_content"
  29.  
  30.                 android:layout_height="wrap_content"
  31.  
  32.                 android:layout_alignParentRight="true"
  33.  
  34.                 android:layout_marginRight="5px"
  35.  
  36.                 android:layout_below="@id/MyTV" />
  37.  
  38.                
  39.  
  40.         <Button id="@+id/check_LogDB"
  41.  
  42.                 android:text="@string/checkLogDB"
  43.  
  44.                 android:layout_width="wrap_content"
  45.  
  46.                 android:layout_height="wrap_content"
  47.  
  48.                 android:layout_toRight="@id/check_AppDB"
  49.  
  50.                 android:layout_alignTop="@id/check_AppDB" />
  51.  
  52.                
  53.  
  54. </LinearLayout>
Parsed in 0.003 seconds, using GeSHi 1.0.8.4


But I don't konw why here's the result on the emulator :

-----------------
| A textview | //TextView
-----------------
-------------
| Button1 |
-------------
-------------
| Button2 |
-------------

I don't what i forgot but I didn't manage to display my 2 buttons on the same "line"

Does somebody see what to do?

Thx :)
Last edited by bibiodp on Thu Dec 13, 2007 3:40 pm, edited 1 time in total.
I'm a poor lonesome French developper ;)
bibiodp
Junior Developer
Junior Developer
 
Posts: 12
Joined: Mon Nov 26, 2007 6:18 pm

Top

Postby plusminus » Thu Dec 13, 2007 3:28 pm

Hello bibiodp,

:idea: you can achieve this in two different ways.

The error with your way is, that your were using realtive descriptions on your items but as the surrounding layout you were using LinearLayout instead of RelativeLayout.

Example taken from :arrow: this tutorial (click):
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!-- Demonstrates using a RELATIVE LAYOUT to create a form -->
  3. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android">
  4.  
  5.     <!-- some items here -->
  6. </RelativeLayout>
Parsed in 0.001 seconds, using GeSHi 1.0.8.4


The second way is to cascade different LinearLayouts, like we did it with the :arrow: CellID-to-Lat/Long.

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby bibiodp » Thu Dec 13, 2007 3:39 pm

Now that I read it, it seems so logical...
Thx a lot :)
I'm a poor lonesome French developper ;)
bibiodp
Junior Developer
Junior Developer
 
Posts: 12
Joined: Mon Nov 26, 2007 6:18 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 4 guests