Dev*_*per 0 android android-layout android-linearlayout
我必须创建具有一个图像和多个textview和这样的评级的布局,并且我在使用适配器对此布局进行充气时添加一行
| Image| Name of Product |
| Desc |
| Amount |
| EMI details |
| Rating Sybmol total Rating |
Run Code Online (Sandbox Code Playgroud)
所以我试图创建这样的布局
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<LinearLayout
android:id="@+id/mainLinearLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:orientation="horizontal" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_launcher"
android:layout_marginTop="5dp"
android:layout_marginLeft="10dp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:id="@+id/text"
android:text="Micromax Canvas Spark"
android:textColor="@android:color/black" />
</LinearLayout>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
但我很困惑如何创建布局请帮助我
这就是我假设你要完成的事情.

<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginLeft="16dp"
android:layout_marginTop="16dp"
android:src="@mipmap/ic_launcher"/>
<LinearLayout
android:id="@+id/mainLinearLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginLeft="72dp"
android:orientation="vertical">
<TextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="16dp"
android:text="Micromax Canvas Spark"
android:textColor="@android:color/black"/>
<TextView
android:id="@+id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:text="Micromax Canvas Spark"
android:textColor="@android:color/black"/>
<TextView
android:id="@+id/text2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:text="Micromax Canvas Spark"
android:textColor="@android:color/black"/>
<TextView
android:id="@+id/text3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:text="Micromax Canvas Spark"
android:textColor="@android:color/black"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp">
<RatingBar
android:id="@+id/ratingBar"
style="?android:attr/ratingBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:rating="2"/>
<TextView
android:id="@+id/text4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:text="1003 Votes"
android:textColor="@android:color/black"/>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
ListView的分隔符
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="#fff"
android:dividerHeight="1dp"/>
Run Code Online (Sandbox Code Playgroud)
更新
更改评级栏的大小.
style="?android:attr/ratingBarStyleSmall"
style="?android:attr/ratingBarStyleIndicator" // Perfect Size but stars are blue
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3690 次 |
| 最近记录: |