2012-07-10 6 views
6

TextView와 같은보기에는 자체 여백 또는 여백이 있습니다 ... textView에 textSize 16dp를 설정하면이 컨트롤을 표시하기 위해 hdpi 장치 화면에서 24 픽셀 이상이 소요됩니다. . @ DIMEN/activity_vertical_margin 또는 @ DIMEN/activity_horizontal_margin : 레이아웃을 사용하는 동안 어쩌면 내가 모르는 뭔가가있어, 안드로이드에서안드로이드 기본 채우기 또는 여백

<LinearLayout 
     android:id="@+id/uc_button_title_panel" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:orientation="vertical" > 

     <View 
      android:layout_width="match_parent" 
      android:layout_height="1px" 
      android:background="@color/closed_red" /> 

     <TextView 
      android:id="@+id/uc_button_title_text" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_margin="0dp" 
      android:includeFontPadding="false" 
      android:background="@null" 
      android:padding="0dp" 
      android:text="@string/demo_text" 
      android:textColor="#325083" 
      android:textSize="16dp" 
      android:textStyle="bold" /> 

     <View 
      android:layout_width="match_parent" 
      android:layout_height="1px" 
      android:background="@color/closed_red" /> 
    </LinearLayout> 
+0

http://developer.android.com/guide/practices/screens_support.html의 1.5x 배율을 기반으로 정확히 24 일 것으로 예상됩니까? –

+0

글쎄, 그래, 내가 hdpi 장치에 24px 텍스트 크기를 가져 오려면 16dp로 textSize를 설정해야합니까? – Orest

+0

네가 맞다면 그 관계를 이해하려고 애쓰는 것 뿐이다. 그렇다면 실제 텍스트가 24px 또는 텍스트 + 주위의 공백보다 큽니다. –

답변

4
<LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_marginTop="@dimen/activity_vertical_margin" 
     android:layout_marginBottom="@dimen/activity_vertical_margin" 
     android:layout_marginLeft="@dimen/activity_horizontal_margin" 
     android:layout_marginRight="@dimen/activity_horizontal_margin" 
     android:orientation="vertical"> 
    </LinearLayout> 

도와주세요, 기본 마진과 가능한 패딩이있다. 위의 예제 코드를 넣었습니다.

관련 문제