TextView
(이 예제에서는 7 개)의 난수가있는 내부에 LinearLayout
이 화면의 전체 너비를 덮고 있습니다. 나는 모두 TextView
이 같은 크기이므로, 각각에 android:layout_weight="1"
이라는 속성을 넣었습니다.TextView가 부모 LinearLayout의 크기를 조정하는 것을 방지하려면 - Android
을하지만 각 TextView
에 해당하는 텍스트를 추가 할 때, Textview
변화의 크기, 무게를 유지하고 LinearLayout
크기를 조정할 수 없습니다 :
텍스트 뷰의 모든 텍스트가없는 잘 작동
이 내 활동의 디자인의 일부에 불과합니다, 그래서 그 자체에 대한 새로운 XML에 재현 오류가 지속되면 e. 그리고 나는 LinearLayout
가 HorizontalScrollView
의 내부에있는 경우는 그렇지 않은 경우, 내가 예상 결과를 얻을 발생하는 것으로 나타났습니다 :
내 XML :
<HorizontalScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal">
<TextView
android:singleLine="true"
android:text="LONG TEXT"
android:layout_marginBottom="1dp"
android:layout_marginTop="1dp"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:background="#009FDC"
android:gravity="center"
android:padding="5dp"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#fff"
android:textStyle="bold"
android:typeface="serif" />
<TextView
android:singleLine="true"
android:layout_marginLeft="1dp"
android:text="LONG TEXT"
android:layout_marginBottom="1dp"
android:layout_marginTop="1dp"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:background="#009FDC"
android:gravity="center"
android:padding="5dp"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#fff"
android:textStyle="bold"
android:typeface="serif" />
<TextView
android:singleLine="true"
android:layout_marginLeft="1dp"
android:text="LONG TEXT"
android:layout_marginBottom="1dp"
android:layout_marginTop="1dp"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:background="#009FDC"
android:gravity="center"
android:padding="5dp"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#fff"
android:textStyle="bold"
android:typeface="serif" />
<TextView
android:singleLine="true"
android:layout_marginLeft="1dp"
android:text="LONG TEXT"
android:layout_marginBottom="1dp"
android:layout_marginTop="1dp"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:background="#009FDC"
android:gravity="center"
android:padding="5dp"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#fff"
android:textStyle="bold"
android:typeface="serif" />
<TextView
android:singleLine="true"
android:layout_marginLeft="1dp"
android:text="LONG TEXT"
android:layout_marginBottom="1dp"
android:layout_marginTop="1dp"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:background="#009FDC"
android:gravity="center"
android:padding="5dp"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#fff"
android:textStyle="bold"
android:typeface="serif" />
<TextView
android:singleLine="true"
android:layout_marginLeft="1dp"
android:text="LONG TEXT"
android:layout_marginBottom="1dp"
android:layout_marginTop="1dp"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:background="#009FDC"
android:gravity="center"
android:padding="5dp"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#fff"
android:textStyle="bold"
android:typeface="serif" />
<TextView
android:singleLine="true"
android:layout_marginLeft="1dp"
android:text="LONG TEXT"
android:layout_marginBottom="1dp"
android:layout_marginTop="1dp"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:background="#009FDC"
android:gravity="center"
android:padding="5dp"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#fff"
android:textStyle="bold"
android:typeface="serif" />
</LinearLayout>
</HorizontalScrollView>
을
누구든지이 문제를 해결하는 방법을 알고 있습니까? 미리 감사드립니다.
설정을하여 높이와 너비 동적으로 textView합니다. –
TextView에 텍스트 크기 속성을 설정합니다. – chain
view를 스크롤하여 'horizontalScrollView'안에 뷰를 두는 이유는 무엇입니까? –