Android: layout_toRightOf and android: layout_below

Here I developed one application. Here I want to use the o / p format as shown below:

Artist:      artist
Duration:    duration
Title:       title.

But I got o / p :

Artist:
    artist
Durstion:
    duration
Title: 
    title

Here I want to use the above format.

How can i do this?

Here I used below code for my layout file. But I can’t get a way out of my demand. So please help me and give me some ideas. Please help me

this is my layout file:

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

<LinearLayout
    android:id="@+id/orderinformation"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/payment_method1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingLeft="5px"
        android:text="Artist"
        android:textSize="15dip"
        android:textStyle="bold" />

    <TextView
        android:id="@+id/artist"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
         android:layout_toRightOf="@+id/payment_method1"
        android:paddingLeft="75px"
        android:text="artist"
        android:textColor="#10bcc9"
        android:textSize="15dip"
        android:textStyle="bold" />

    <TextView
        android:id="@+id/total1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingLeft="5px"
        android:text="Duration"
         android:layout_below="@id/payment_method1"
        android:textSize="15dip"
        android:textStyle="bold" />

    <TextView
        android:id="@+id/duration"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingLeft="65px"
        android:layout_toRightOf="@+id/total1"
        android:text="duration"
        android:textColor="#10bcc9"
        android:textSize="15dip"
        android:textStyle="bold" />
   </LinearLayout>

   <LinearLayout
   android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical" 
     android:layout_below="@id/orderinformation" >   
   <TextView
     android:id="@+id/firstname1"
    android:paddingLeft="5px"
     android:textSize="15dip"
      android:layout_below="@id/total1"
   android:text="Title"
    android:textStyle="bold"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"/>
  <TextView
     android:id="@+id/title"
      android:text="title"
    android:paddingLeft="65px"
     android:layout_toRightOf="@+id/firstname1"
     android:textSize="15dip"
    android:textColor="#10bcc9"
    android:textStyle="bold"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"/>
  </LinearLayout>

    </LinearLayout>
+1
source share
5 answers

LinearLayout , . RelativeLayout. android:layout_toRightOf RelativeLayout, LinearLayout.

TableLayout, TextView TableRow.

,

<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" >

    <TableRow>

        <TextView
            android:id="@+id/payment_method1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:padding="10dip"
            android:text="Artist"
            android:textSize="15dip"
            android:textStyle="bold" />

        <TextView
            android:id="@+id/artist"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:padding="10dip"
            android:text="artist"
            android:textColor="#10bcc9"
            android:textSize="15dip"
            android:textStyle="bold" />
    </TableRow>

    <TableRow>

        <TextView
            android:id="@+id/total1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:padding="10dip"
            android:text="Duration"
            android:textSize="15dip"
            android:textStyle="bold" />

        <TextView
            android:id="@+id/duration"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:padding="10dip"
            android:text="duration"
            android:textColor="#10bcc9"
            android:textSize="15dip"
            android:textStyle="bold" />
    </TableRow>

    <TableRow>

        <TextView
            android:id="@+id/firstname1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:padding="10dip"
            android:text="Title"
            android:textSize="15dip"
            android:textStyle="bold" />

        <TextView
            android:id="@+id/title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:padding="10dip"
            android:text="title"
            android:textColor="#10bcc9"
            android:textSize="15dip"
            android:textStyle="bold" />
    </TableRow>

</TableLayout>
+5

- :

    <LinearLayout... orientation = vertical>

        <LinearLayout... orientation = horizontal>
            <TextView  title>
            <TextView  value>
        </LinearLayout>

        <LinearLayout... orientation = horizontal>
            <TextView  title>
            <TextView  value>
        </LinearLayout>

    </LinearLayout>

TableLayout

. ,

0

, , , . TextView, .

0

you need to use RelativeLayout, if you want to adjust your text image to suit you, then

0
source

Try it. It will also help resolve your requirement.

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/t2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dip" >

<TableRow
    android:id="@+id/tableRow1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" >

    <TextView
        android:id="@+id/payment_method1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingLeft="5px"
        android:text="Artist"
        android:textSize="15dip"
        android:textStyle="bold" />

    <TextView
        android:id="@+id/artist"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingLeft="65px"
        android:text="artist"
        android:textColor="#10bcc9"
        android:textSize="15dip"
        android:textStyle="bold" />
</TableRow>

<TableRow
    android:id="@+id/tableRow2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="5dp" >

    <TextView
        android:id="@+id/total1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/payment_method1"
        android:paddingLeft="5px"
        android:text="Duration"
        android:textSize="15dip"
        android:textStyle="bold" />

    <TextView
        android:id="@+id/duration"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingLeft="65px"
        android:text="duration"
        android:textColor="#10bcc9"
        android:textSize="15dip"
        android:textStyle="bold" />
</TableRow>

<TableRow
    android:id="@+id/tableRow3"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="5dp" >

    <TextView
        android:id="@+id/firstname1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/total1"
        android:paddingLeft="5px"
        android:text="Title"
        android:textSize="15dip"
        android:textStyle="bold" />

    <TextView
        android:id="@+id/title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_toRightOf="@+id/firstname1"
        android:paddingLeft="65px"
        android:text="title"
        android:textColor="#10bcc9"
        android:textSize="15dip"
        android:textStyle="bold" />
</TableRow>

0
source

All Articles