在这里,我已经开发了一个应用程序。在这里,我想需要O / P 象下面这样的格式:
歌手:歌手持续时间:持续时间标题:标题。
但我得到的O / P 是:
歌手: 艺术家Durstion: 为期标题: 标题
在这里,我想需要上面的格式。
我怎样才能做到这一点?
下面我用下面code为我的布局文件。但我不能让我的要求输出。所以,请帮助我,给我一些想法。请大家帮我
这是我的布局文件:
<?XML版本=1.0编码=UTF-8&GT?;< LinearLayout中的xmlns:机器人=http://schemas.android.com/apk/res/android机器人:layout_width =FILL_PARENT 机器人:layout_height =WRAP_CONTENT 机器人:方向=垂直><的LinearLayout 机器人:ID =@ + ID / orderinformation 机器人:layout_width =FILL_PARENT 机器人:layout_height =WRAP_CONTENT 机器人:方向=垂直> <的TextView 机器人:ID =@ + ID / payment_method1 机器人:layout_width =WRAP_CONTENT 机器人:layout_height =WRAP_CONTENT 机器人:paddingLeft =5像素 机器人:文字=艺术家 机器人:TEXTSIZE =15dip 机器人:文字样式=大胆/> <的TextView 机器人:ID =@ + ID /艺术家 机器人:layout_width =WRAP_CONTENT 机器人:layout_height =WRAP_CONTENT 机器人:layout_toRightOf =@ + ID / payment_method1 机器人:paddingLeft =960x75像素 机器人:文字=艺术家 机器人:文字颜色=#10bcc9 机器人:TEXTSIZE =15dip 机器人:文字样式=大胆/> <的TextView 机器人:ID =@ + ID /共1页 机器人:layout_width =WRAP_CONTENT 机器人:layout_height =WRAP_CONTENT 机器人:paddingLeft =5像素 机器人:文字=持续时间 机器人:layout_below =@ ID / payment_method1 机器人:TEXTSIZE =15dip 机器人:文字样式=大胆/> <的TextView 机器人:ID =@ + ID /时间 机器人:layout_width =WRAP_CONTENT 机器人:layout_height =WRAP_CONTENT 机器人:paddingLeft =65px 机器人:layout_toRightOf =@ + ID /共1页 机器人:文字=时间 机器人:文字颜色=#10bcc9 机器人:TEXTSIZE =15dip 机器人:文字样式=大胆/> < / LinearLayout中> <的LinearLayout 机器人:layout_width =FILL_PARENT 机器人:layout_height =WRAP_CONTENT 机器人:方向=垂直 机器人:layout_below =@ ID / orderinformation> <的TextView 机器人:ID =@ + ID / FIRSTNAME1 机器人:paddingLeft =5像素 机器人:TEXTSIZE =15dip 机器人:layout_below =@ ID /共1页 机器人:文字=标题 机器人:文字样式=大胆 机器人:layout_width =WRAP_CONTENT 机器人:layout_height =WRAP_CONTENT/> <的TextView 机器人:ID =@ + ID /标题 机器人:文字=标题 机器人:paddingLeft =65px 机器人:layout_toRightOf =@ + ID / FIRSTNAME1 机器人:TEXTSIZE =15dip 机器人:文字颜色=#10bcc9 机器人:文字样式=大胆 机器人:layout_width =WRAP_CONTENT 机器人:layout_height =WRAP_CONTENT/> < / LinearLayout中> < / LinearLayout中>
解决方案
由于您使用的LinearLayout与方向垂直,您将得到previous布局之下的每个新的布局。最好将使用RelativeLayout的。由于的android:layout_toRightOf
是的RelativeLayout的属性将在LinearLayout中没有效果。
在你的情况下,最好将使用TableLayout,只是你必须把里面的TextView的TableRow。
伪code,
<?XML版本=1.0编码=UTF-8&GT?;< TableLayout的xmlns:机器人=http://schemas.android.com/apk/res/android 机器人:layout_width =FILL_PARENT 机器人:layout_height =WRAP_CONTENT> <&的TableRow GT; <的TextView 机器人:ID =@ + ID / payment_method1 机器人:layout_width =WRAP_CONTENT 机器人:layout_height =WRAP_CONTENT 机器人:填充=10dip 机器人:文字=艺术家 机器人:TEXTSIZE =15dip 机器人:文字样式=大胆/> <的TextView 机器人:ID =@ + ID /艺术家 机器人:layout_width =WRAP_CONTENT 机器人:layout_height =WRAP_CONTENT 机器人:填充=10dip 机器人:文字=艺术家 机器人:文字颜色=#10bcc9 机器人:TEXTSIZE =15dip 机器人:文字样式=大胆/> < /&的TableRow GT; <&的TableRow GT; <的TextView 机器人:ID =@ + ID /共1页 机器人:layout_width =WRAP_CONTENT 机器人:layout_height =WRAP_CONTENT 机器人:填充=10dip 机器人:文字=持续时间 机器人:TEXTSIZE =15dip 机器人:文字样式=大胆/> <的TextView 机器人:ID =@ + ID /时间 机器人:layout_width =WRAP_CONTENT 机器人:layout_height =WRAP_CONTENT 机器人:填充=10dip 机器人:文字=时间 机器人:文字颜色=#10bcc9 机器人:TEXTSIZE =15dip 机器人:文字样式=大胆/> < /&的TableRow GT; <&的TableRow GT; <的TextView 机器人:ID =@ + ID / FIRSTNAME1 机器人:layout_width =WRAP_CONTENT 机器人:layout_height =WRAP_CONTENT 机器人:填充=10dip 机器人:文字=标题 机器人:TEXTSIZE =15dip 机器人:文字样式=大胆/> <的TextView 机器人:ID =@ + ID /标题 机器人:layout_width =WRAP_CONTENT 机器人:layout_height =WRAP_CONTENT 机器人:填充=10dip 机器人:文字=标题 机器人:文字颜色=#10bcc9 机器人:TEXTSIZE =15dip 机器人:文字样式=大胆/> < /&的TableRow GT;< / TableLayout>
Here I have developed one app. Here I wish to need the o/p like below format:
Artist: artist
Duration: duration
Title: title.
But I got the o/p is:
Artist:
artist
Durstion:
duration
Title:
title
Here I wish to need the above format.
How can I do this?
Here I have used below code for my layout file. But I can't get the my requirement output. 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>
解决方案
As you are using LinearLayout with orientation as vertical you will get every new layout below the previous Layout. Better would be use RelativeLayout. As android:layout_toRightOf
is a property of RelativeLayout it will have no effect in LinearLayout.
The best in your case would be using TableLayout, just you have to put TextView inside TableRow.
Pseudo code,
<?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>
上一篇:System.Net.ProtocolViolationException异常C#邮政GETRESPONSE异常、邮政、Net、System
下一篇:将 JAX-RS 应用程序部署到 Tomcat 时出现 IncompatibleClassChangeError应用程序、RS、JAX、Tomcat