2012-08-02 3 views
3

단일 라인이있는 간단한 TextView가 있습니다. 높이를 match_parent/fill_parent로 설정하고 싶지만 Android의 동작은 wrap_content에만 있습니다.TextView 높이가 match_parent가 아님/fill_parent

TextView의 모든 높이를 강요하는 방법이 있습니까?

TKX

편집 :

enter image description here 내 레이아웃 : 그 TextView 부모 폭

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

<TextView 
     android:id="@+id/date" 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:gravity="center" 
     android:paddingLeft="13dp" 
     android:paddingRight="3dp" 
     android:textColor="@android:color/white" 
     android:textStyle="bold" /> 

     [...] 

</RelativeLayout> 
+0

같은 문제가 있습니까? 다른 시나리오로 끝났습니까? 아니면이 시나리오로 해결 되었습니까? – htafoya

답변

0

, 당신은 wrap_content을 사용할 수를

이 내가 무엇을 얻을 수 있습니다.

0

TextView의 높이를 match_parent/fill_parent으로 설정할 수 있습니다. 그리고 중력다른 모든 속성TextView 요구 사항에 따라 변경하십시오.

귀하에게 이것이 충분하지 않다면 정확히 무엇을하고 싶은지 알려주십시오.

편집 : 내가 코드에 근무 새로운 편집 코드 당으로

.

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_height="match_parent" 
android:layout_width="match_parent"> 
<TextView android:id="@+id/date" 
    android:layout_width="wrap_content" 
    android:layout_height="match_parent" 
    android:gravity="center" 
    android:paddingLeft="13dp" 
    android:paddingRight="3dp" 
    android:textStyle="bold" 
    android:textColor="#ffffff" 
    android:text="dateText"/> 
</RelativeLayout> 

는 이제 전체 화면 central_vertical 위치에서 텍스트 뷰를 도시.

이 코드를 사용해보십시오. 그 일. RelativeLayoutTextView으로 변경했습니다.

+0

내 메시지를 편집했습니다. 해결책이 작동하지 않습니다. – g123k

+0

편집 후 효과가 있습니까? – Debarati