0

在我的应用程序中,我有一个列表视图,因为我需要放置以下 UI在此处输入图像描述

如上图所示,我能够在垂直方向的线性布局中获得圆形背景。所以我已经按顺序放置了以下内容 1. TextView 2. FrameLayout 中的 ImageView 以便可以将 TextView 放置在 FrameLayout 3 内的 ImageView 上,然后再放置一个 TextView

Now my problem is 
1. i want to place the image view of the calendar icon at the top right corner, so that a part of the icon gets placed over the image view 
2. The image inside the Frame layouts imageview is received from an url without round corners. I want to show round corners over the image

以下是我的布局内容

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical" >

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" 
        android:background="@drawable/img_bg"
        android:layout_margin="10dp">

        <TextView
            android:id="@+id/event_list_header"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@string/app_name"
            android:textColor="@color/title"
            android:textAppearance="?android:attr/textAppearanceLarge" 
            android:layout_marginTop="10dp"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"/>

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical" 
            android:layout_margin="6dp">

            <FrameLayout
                android:layout_width="fill_parent"
                android:layout_height="wrap_content">

                <ImageView
                    android:contentDescription="@string/app_name"
                    android:id="@+id/event_list_image"
                    android:layout_width="fill_parent"
                    android:layout_height="280dp"/>

                <RelativeLayout
                    android:layout_width="fill_parent"
                    android:layout_height="match_parent" 
                    android:background="@drawable/offer_title_bg"
                    android:layout_gravity="bottom">

                    <TextView
                        android:id="@+id/event_overlay_text"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentLeft="true"
                        android:layout_centerVertical="true"
                        android:textColor="#FFFFFF"
                        android:layout_marginLeft="10dp"
                        android:textAppearance="?android:attr/textAppearanceMedium" />
                </RelativeLayout>
            </FrameLayout>
        </LinearLayout>

        <TextView
            android:id="@+id/event_timing_text"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@string/app_name"
            android:textColor="@color/black"
            android:textAppearance="?android:attr/textAppearanceLarge" 
            android:layout_marginBottom="10dp"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"/>

    </LinearLayout>

</RelativeLayout>

如何使这个 UI 成为可能......

4

1 回答 1

0

使用 RelativeLayout 和 alignTop:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical" >

    <ImageView
        android:id="@+id/event_list_image"
        android:layout_width="110dip"
        android:layout_height="110dip"
        android:layout_margin="1dip"
        android:src="@drawable/main0x" />

    <TextView
        android:id="@+id/event_overlay_text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignTop="@+id/event_list_image"
        android:layout_marginLeft="100dp"
        android:layout_marginTop="1dp"/>


</RelativeLayout>
于 2012-09-17T05:14:32.910 回答