2012-06-09 5 views
4

편집 텍스트가 내 텍스트와 일치하도록 텍스트의 크기를 조정하기 만하면됩니다. edittext를 3 열의 표 레이아웃에 삽입하면 3 열의 전체 공간을 채우고 커 보인다. 크기를 변경하고 싶습니다. 그게 어떻게 가능해? 방금에서 열 1 & 2 스트레치 공간에 맞게 텍스트를 편집하려면 자체가 그냥 거기에 배치 그것을 선택합니다 열 번호를 지정할 필요가 없습니다테이블 레이아웃에서 EditText를 변경하거나 크기를 조정하는 방법은 무엇입니까?

<TableRow> 
    <TextView 
     android:layout_column="1" 
     android:text="S" 
     android:layout_width="150dp" 
     /> 

    <TextView 
     android:layout_column="2" 
     android:text="C" 
     android:layout_width="75dp" /> 

    <TextView 
     android:layout_column="3" 
     android:text="G"/> 
</TableRow> 

<View 
    android:layout_height="2dip" 
    android:background="#FF909090" /> 

<TableRow> 
<TextView 
    android:layout_column="1" 
    android:id="@+id/s1" 
    android:text="Medium Text"/> 
<TextView 
    android:layout_column="2" 
    android:id="@+id/c1" 
    android:text="Text"/> 

<EditText 
    android:id="@+id/g1" 
    android:layout_column="3" /> 
</TableRow> 
+0

무엇 너는 원하는가? 약간의 혼란 스러움, 너비 또는 높이를 변경하고 싶습니까? – Sajmon

답변

1

을 시도해보십시오 테이블 행으로 선형 레이아웃을 추가하고 할당 할 수 있습니다 roblem ... 내가 wrap_content 등을 사용하여 시도 ...하지만 당신이 didnt 한 작업을 수동으로 글고의 높이를 설정합니다 .... 여기에 코드입니다 :

<?xml version="1.0" encoding="utf-8"?> 

<TableRow 
    android:id="@+id/tableRow2" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:weightSum="3" > 

    <TextView 
     android:id="@+id/textView2" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:layout_weight="1" 
     android:text="TextView" /> 

    <TextView 
     android:id="@+id/textView5" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:layout_weight="1" 
     android:text="TextView" /> 

    <EditText 
     android:id="@+id/editText1" 
     android:layout_width="fill_parent" 
     android:layout_height="15dp" 
     android:layout_weight="1" /> 



</TableRow> 
+0

작동 했습니까 ?? 나중에 수동으로 높이를 설정하는 것 이외의 다른 방법을 발견하면 알려주십시오. :) – Shark

0

: 다음은 내 .XML 코딩입니다 테이블 레이아웃

또는 체중

0

나는 당신의 페이지를 이해

<EditText 
     android:layout_width="fill_parent" 
     android:id="@+id/txthwdxml" 
     android:layout_height="wrap_content" /> 
1

이러한 시도,

1. Set the "stretchColumn" property of table layout. 

2. Set the layout_width of the EditText to "wrap_content". 

3. If you want you can fix the size of the EditText by manually setting 
    the layout_width value in dp or dip. 
관련 문제