은 수평 방향무게가 지정된 스틱이 왜 고정되지 않습니까?
I은 layout_weight를 함께 5 TableLayout을 (폭 & 높이 wrap_content)를 넣어서 후, weightSum = "5"와 난 의 LinearLayout (폭 & 높이 match_parent)를 가지고 있다고 가정 = "1"이므로 모든 TableLayout은 부모의 1/5입니다. (내 관점에서) 즉 각 TableLayout을에 나는 텍스트 뷰 (폭 & 높이 wrap_content)을 넣어 모든 일이 잘못 후
는하지만, :
텍스트는 그 다음 긴에있는 경우 은 부모 레이아웃 (우리의 경우 TableLayout)을 이을 소비하도록 강제하므로 TextView, ellipsize = "end"를 지정 했음에도 불구하고 LinearLayout 부모로부터의 TableLayout의 1/5 비율이 더 이상 존중되지 않습니다.
음 일부 reserch을 수행 한 후 나는 layout_width을 설정하면 (weightSum 같은) 다른 모든 속성보다 강한 것으로 나타났습니다. 내 경우나는 TableLayout을의 폭 = wrap_content뿐만 아니라 에 layout_weight가 wrap_content이기 때문에 = "1"는하지만, 그것의 내용 이후 소비 경향과 무게를 존중하지를 설정합니다.
누군가 내 솔루션을 어떻게 줄 수 있습니까, 내 테이블 레이아웃은 무게를 존중할 수 있습니까? (왜냐하면 내 레이아웃은 비율을 고려하지 않고 하위 텍스트보기의 길이 이후에 소비하기를 원하지 않기 때문입니다).
감사합니다. 여기 내 코드는 다음과 같습니다.
<!-- my code -->
< LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:weightSum="5" >
<!-- table 1 -->
<TableLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:ellipsize="end"
android:maxLines="1"
android:text="test1test2test3test4test5"
android:textSize="20dp"/>
<TableLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
</TableLayout>
</TableLayout>
<!-- table 2 -->
<TableLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="test"
android:textSize="20dp" />
<TableLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
</TableLayout>
</TableLayout>
<!-- table 3 -->
<TableLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="test"
android:textSize="20dp" />
<TableLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
</TableLayout>
</TableLayout>
<!-- table 4 -->
<TableLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="test"
android:textSize="20dp" />
<TableLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
</TableLayout>
</TableLayout>
<!-- table 5 -->
<TableLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="test"
android:textSize="20dp" />
<TableLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
</TableLayout>
</TableLayout>
</LinearLayout>
답장을 보내 주셔서 감사합니다.나는 0 dp에 대해 몰랐고 그 다음에 무게를 설정했지만 멋졌습니다. :) TableLayout 내부에 대해서는 내 미래의 작업을위한 다른 View로 채워질 것입니다. –