2013-12-19 55 views
-1

我嘗試使文本視圖覆蓋上述文本視圖我try'ed文本對齊,但沒有成功,我可以通過添加大量的填充來完成此操作,但我不想使用填充,因爲我遇到了各種屏幕尺寸的android中的其他問題。我會發布我想要做的事情的圖片,併發布XML代碼。在這裏看到一些幫助thanks.Image(我正在嘗試使文本android /設計覆蓋上面的區域,說busbusy開發截至目前的黑色文本視圖只是推上述文本視圖的黑色欄是我希望它只是覆蓋,但留在這同一位置)http://imgur.com/ebgNTNk使文本視圖覆蓋另一個文本視圖

<?xml version="1.0" encoding="utf-8"?> 

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical"> 



    <RelativeLayout 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content"> 

     <TextView 
      android:id="@+id/org_name" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="4dp" 
      android:layout_marginLeft="4dp" 
      android:layout_marginRight="4dp" 
      android:gravity="center_horizontal" 
      android:paddingTop="42dp" 
      android:paddingBottom="42dp" 
      android:background="@drawable/dashboard_business_image" 
      android:textColor="@color/busy_black" 
      android:textStyle="bold" 
      android:textAppearance="?android:attr/textAppearanceMedium"> 
     </TextView> 

     <TextView 
      android:id="@+id/project_name" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="4dp" 
      android:layout_below="@id/org_name" 
      android:layout_marginRight="4dp" 
      android:gravity="center_horizontal" 
      android:layout_gravity="bottom" 
      android:paddingTop="2dp" 
      android:paddingBottom="2dp" 
      android:background="@color/busy_translucent_black" 
      android:textColor="@color/busy_white" 
      android:textStyle="normal" 
      android:textAppearance="?android:attr/textAppearanceSmall" 
      android:visibility="gone"> 
     </TextView> 
    </RelativeLayout> 
    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:layout_weight="1" 
     android:orientation="vertical"> 

     <include layout="@layout/dashboard_clock_in_button" /> 
     <include layout="@layout/dashboard_clock_out_button" /> 
     <include layout="@layout/dashboard_paused_button" /> 

     <ListView 
      android:id="@+id/action_list" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="4dp" 
      android:layout_marginRight="4dp" 
      android:divider="@color/busy_divider_color" 
      android:dividerHeight="0dp"> 
     </ListView> 

    </LinearLayout> 

    <TextView 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:layout_marginLeft="4dp" 
     android:layout_marginRight="4dp" 
     android:layout_weight="0" 
     android:gravity="center_horizontal" 
     android:paddingTop="32dp" 
     android:paddingBottom="32dp" 
     android:background="@color/busy_white" 
     android:textColor="@color/busy_black" 
     android:textStyle="bold" 
     android:textAppearance="?android:attr/textAppearanceMedium" /> 

</LinearLayout> 

回答

3

讀這個,看起來你想project_name視圖覆蓋org_name視圖。您可以通過對齊視圖的底部來完成此操作。

改變這一行:

android:layout_below="@id/org_name" 

要這樣:

android:layout_alignBottom="@id/org_name" 

這將調整的兩種觀點的底部,有效地將project_nameorg_name視圖的頂部。

+0

謝謝!!!!!!這工作完美!對不起,我沒有足夠的積分投票你的答案,但我會讓它成爲我接受的答案!非常感謝你!!!! – jared90

0

他們是不重疊的原因是在第二的TextView的android:layout_below="@id/org_name"。如果你刪除它,我認爲它應該按你想要的那樣工作。如果沒有,你可能想嘗試一個FrameLayout而不是RelativeLayout。