View 中的 TextView 不起作用
TextView within View doesn't work
我正在添加更多不需要的假细节,因为 whosebug.com 坚持这样做......aaa 而且它拒绝 post 我的问题
所以我正在构建 3 个相等的框元素但是:
当我添加 <TextView/>
布局时,布局停止工作...为什么会这样?
<TableLayout
android:layout_width="match_parent"
android:layout_height="74dp"
android:background="@color/sevenBlack" >
<TableRow
android:layout_height="match_parent"
android:weightSum="3">
<View
android:layout_height="match_parent"
android:layout_weight="1">
<!-- WTF!!! -->
<TextView android:text="Hello there"/>
</View>
<View
android:layout_height="match_parent"
android:layout_weight="1"></View>
<View
android:layout_height="match_parent"
android:layout_weight="1"></View>
</TableRow>
</TableLayout>
您不能在 View.
中使用其他视图(TextView
、EditTexts
、Buttons
)
试试这个:
<TableLayout
android:layout_width="match_parent"
android:layout_height="74dp"
android:background="@color/sevenBlack" >
<TableRow
android:layout_height="match_parent"
android:weightSum="3">
<TextView android:text="Hello there"
android:layout_height="match_parent"
android:layout_weight="1"/>
<View
android:layout_height="match_parent"
android:layout_weight="1"></View>
<View
android:layout_height="match_parent"
android:layout_weight="1"></View>
</TableRow>
</TableLayout>
如果您想在每个 View 中使用更多文本视图,请使用 Linear、Relative 或其他 LayoutView.
玩得开心
我正在添加更多不需要的假细节,因为 whosebug.com 坚持这样做......aaa 而且它拒绝 post 我的问题
所以我正在构建 3 个相等的框元素但是:
当我添加 <TextView/>
布局时,布局停止工作...为什么会这样?
<TableLayout
android:layout_width="match_parent"
android:layout_height="74dp"
android:background="@color/sevenBlack" >
<TableRow
android:layout_height="match_parent"
android:weightSum="3">
<View
android:layout_height="match_parent"
android:layout_weight="1">
<!-- WTF!!! -->
<TextView android:text="Hello there"/>
</View>
<View
android:layout_height="match_parent"
android:layout_weight="1"></View>
<View
android:layout_height="match_parent"
android:layout_weight="1"></View>
</TableRow>
</TableLayout>
您不能在 View.
中使用其他视图(TextView
、EditTexts
、Buttons
)
试试这个:
<TableLayout
android:layout_width="match_parent"
android:layout_height="74dp"
android:background="@color/sevenBlack" >
<TableRow
android:layout_height="match_parent"
android:weightSum="3">
<TextView android:text="Hello there"
android:layout_height="match_parent"
android:layout_weight="1"/>
<View
android:layout_height="match_parent"
android:layout_weight="1"></View>
<View
android:layout_height="match_parent"
android:layout_weight="1"></View>
</TableRow>
</TableLayout>
如果您想在每个 View 中使用更多文本视图,请使用 Linear、Relative 或其他 LayoutView.
玩得开心