2014-01-15 2 views
0

다음 XML 파일을 사용하여 조각을 구현했습니다.여백이 작동하지 않습니다.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="@dimen/two_third_width" 
android:layout_height="match_parent" 
android:layout_alignParentLeft="true" 
android:layout_alignParentTop="true" 
android:layout_margin="@dimen/extra_margin" 
android:background="@drawable/found_item_bg" 
tools:context=".FoundItemFragment" > 

<TextView 
    android:id="@+id/found_item_description" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentRight="true" 
    android:layout_alignParentTop="true" 
    android:layout_margin="@dimen/small_margin" 
    android:layout_marginRight="@dimen/extra_margin" 
    android:textColor="@color/BlueText" 
    android:textSize="@dimen/big_title_font" /> 

<TextView 
    android:id="@+id/found_item_catnum_name" 
    android:layout_width="@dimen/item_bg_width" 
    android:layout_height="wrap_content" 
    android:layout_alignParentRight="true" 
    android:layout_below="@id/found_item_description" 
    android:layout_margin="@dimen/small_margin" 
    android:layout_marginRight="@dimen/big_margin" 
    android:background="@drawable/item_name_bg" 
    android:text="@string/catalog_number" 
    android:textSize="@dimen/found_item_font" /> 

<TextView 
    android:id="@+id/found_item_catnum_value" 
    android:layout_width="@dimen/item_bg_width" 
    android:layout_height="wrap_content" 
    android:layout_toLeftOf="@id/found_item_catnum_name" 
    android:layout_alignBaseline="@id/found_item_catnum_name" 
    android:layout_margin="@dimen/small_margin" 
    android:background="@drawable/item_value_bg" 
    android:textSize="@dimen/found_item_font" /> 

    ... 

</RelativeLayout> 

는 상관없이 나는 텍스트 뷰의 요소의 오른쪽 여백에 줄 어떤 가치, 나는 다음과 같은 렌더링을 얻을 : layout

첫 번째 문제는 found_item_description 텍스트 어딘가에 사라 것입니다. 주된 문제는 오른쪽에있는 세 개의 TextView가 레이아웃 내부에 있어야하고 오른쪽으로 확장되지 않아야한다는 것입니다. 내가 layout_marginRight에 대한 모든 종류의 값을 시도했지만, 다양한 값은 아무 효과가없는 것 같습니다. 나는 무언가가 여백 값을 무시하거나 무력화한다고 가정하지만 그것이 무엇이 될지 이해하지 못합니다.

+0

답변으로 게시하려면 확인해 보겠습니다. 내가 다른 세면에 대한 기본값을 갖고 싶어했을 것이기 때문에 이것은 불행한 놀라움으로 다가온다. 그러나 나는 네가 원하는 모든 것을 가질 수는 없다고 생각한다. –

+0

원하는대로 게시물에 대한 답변을 이동했습니다. :) – Gooziec

답변

0

같은 요소에 layout_marginlayout_marginRight을 사용할 수 없습니다. 이 경우 layout_marign 만 적용됩니다. 당신은 오직 한면에 대해 서로 다른 여백을 원하는 경우에 당신은 모든 marginLeft, marginRight, marginTopmarginBottom

0

사이드 메모를 추가 할 필요가 : 나는 오른쪽에서 왼쪽으로 쓰는 언어에 대한 android:layout_marginStart을 사용하는 것이 좋습니다 것입니다.

관련 문제