2013-12-19 4 views
-1

위의 텍스트보기 위에 텍스트보기를 만들려고합니다. 텍스트 정렬을 시도했지만 성공하지 못했지만 많은 양의 패딩을 추가하여이를 수행 할 수 있습니다. 화면 크기에서 안드로이드 다양한 다른 문제를 실행하기 때문에 패딩을 사용하고 싶지 않아요. 내가 뭘하려고하는지 그리고 내가 게시 한 XML 코드를 게시 할 것이다. 여기에 도움을 전하는 몇 가지 도움을 찾고 있습니다. 이미지 (텍스트와 함께 검은 막대를 만들려고 노력 중/디자인 오버레이는 바쁜 말을 나타내는 위의 영역을 나타냅니다. 지금 검은 색 텍스트보기는 위의 텍스트보기를 밀고 있습니다. 그냥 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" 

효과적으로 org_name보기 위에 project_name를 배치, 두 개의 뷰의 하단에 정렬됩니다.

+0

감사합니다 !!!!!! 이것은 완벽하게 작동했습니다! 죄송합니다. 답변을 투표 할 수있는 점수가 충분하지 않지만, 답변을 받아 들일 것입니다! 대단히 감사합니다 !!!! – jared90

0

)가 중복되지 않는 이유를 같은 위치를 오버레이 만에 체류하고자하는 두 번째 텍스트 뷰에서 android:layout_below="@id/org_name"입니다. 만약 당신이 그것을 제거하면, 나는 그것이 당신이 원하는대로 작동해야한다고 생각합니다. 그렇지 않은 경우 RelativeLayout 대신 FrameLayout을 사용해 볼 수 있습니다.