2012-09-17 21 views
0

在我的應用程序,我有一個列表視圖中,我需要把下面的UI enter image description here無法獲得在我的Android應用中的以下UI

正如上面的圖片,我能夠得到圓形背景中顯示在垂直方向的線性佈局中。所以,我已經擺放整齊以下 1. TextView的 2. FrameLayout裏的ImageView,這樣一個TextView可以被放置在裏面的ImageView的FrameLayout 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可能....

+0

把你的代碼,我的朋友,我將編輯和發送給您 –

+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> 
+0

這是不工作... –

+0

你應該改變像屬性:'機器人:layout_below' ,'android:layout_above','android:layout_alignTop','android:layout_marginTop' ... – breceivemail

+0

我已經添加了我的xml佈局,你能否說我在哪裏添加你的答案... –

相關問題