2017-10-11 2 views
0

두 개의 TextView이 내 TableRow에 있는데 그 중 하나에 큰 텍스트가 있습니다. 나는 TextView 첫 번째는 TableRow의 상단에 떠하려면 :TextView를 TableRow의 맨 위로 플로트

<TableRow 
     android:id="@+id/trLocation" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

     <TextView 
      android:id="@+id/textView3" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:text="@string/location"/> 

     <TextView android:layout_width="wrap_content" 
        android:textSize="50dp" 
        android:layout_height="wrap_content" 
        android:text="1234" 
        android:id="@+id/tvLocation" 
        android:layout_weight="1" 
      /> 
    </TableRow> 

내가 layout_gravitygravity를 사용했지만, 둘 다 영향을주지 않습니다.

답변

1

는이

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical"> 


    <TextView 
     android:id="@+id/textView2" 
     android:layout_width="match_parent" 
     android:layout_height="50dp" 
     android:text="Small Text" 
     android:gravity="left|center" 
     android:textAppearance="?android:attr/textAppearanceSmall" /> 

    <TableRow 
     android:id="@+id/trLocation" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 
     <TextView 
      android:id="@+id/tvLocation" 
      android:layout_width="wrap_content" 
      android:layout_height="50dp" 
      android:layout_weight="1" 
      android:text="1234" 
      android:textSize="50dp" /> 
    </TableRow> 

</RelativeLayout> 
+0

이 일부 중복을 소개하는 것보십시오. textsize를 변경하면 두 개의 layout_height도 변경해야합니다. –

+0

dim.xml을 사용하여 textSize와 같은 숫자 값을 설정하면 두 위치에서 변경할 필요가 없습니다. –