无法在我的Android应用程序中获取以下UI

时间:2012-09-17 05:11:41

标签: android user-interface

在我的应用中,我有一个列表视图,因为我需要放置以下用户界面enter image description here

如上图所示,我可以在垂直方向的线性布局中获得圆形背景。所以我已按顺序放置以下内容 1. TextView 2. FrameLayout中的ImageView,以便TextView可以放在FrameLayout内的ImageView上 3.再次使用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成为可能......

1 个答案:

答案 0 :(得分: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>