【发布时间】:2015-01-16 06:10:13
【问题描述】:
我想创建一个像我在屏幕截图中发布的视图,采用圆形布局,一个带有一些背景颜色的图像视图和一个文本视图,位于带有白色背景的图像视图下方,完整的父级应该如图所示为蓝色,我已经尝试但无法得到结果我将在下面发布我的代码,请指导我? 我需要的观点是
我正在使用我创建的布局获得此输出
我的布局代码是
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/parent_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#202230"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<RelativeLayout
android:id="@+id/circle_layout"
android:layout_width="90dp"
android:layout_height="90dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:background="@drawable/whitecircle" >
<RelativeLayout
android:id="@+id/circle_layoutinner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/rating_viewtv"
android:layout_alignParentTop="true"
android:background="@drawable/circletwo"
android:layout_marginTop="1dp"
android:layout_centerHorizontal="true" >
<TextView
android:id="@+id/ratingcup_viewtv_fonts"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="M"
android:gravity="center"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@android:color/holo_purple" />
</RelativeLayout>
<View android:id="@+id/seprater_viewtv"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_above="@+id/rating_viewtv"
android:background="#2b2c3a" />
<TextView
android:id="@+id/rating_viewtv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="3dp"
android:text="4.5"
android:textColor="@android:color/holo_purple" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
and my whitecircle.xml is
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:innerRadius="0dp"
android:shape="ring"
android:thicknessRatio="2"
android:useLevel="false">
<solid android:color="@color/white" />
</shape>
and my circletwo.xml is
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:innerRadius="0dp"
android:shape="ring"
android:thicknessRatio="2"
android:useLevel="false">
<solid android:color="#ff9546" />
</shape>
【问题讨论】:
标签: android xml android-layout