Android 表格布局未正确显示
我的Android应用程序的布局有问题。 图形预览编辑器向我显示的图像如下(这就是我希望它的外观): 我使用的表格布局如下所示:Android 表格布局未正确显示,android,android-tablelayout,android-styles,Android,Android Tablelayout,Android Styles,我的Android应用程序的布局有问题。 图形预览编辑器向我显示的图像如下(这就是我希望它的外观): 我使用的表格布局如下所示: <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_pare
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="5dp"
android:shrinkColumns="*"
android:stretchColumns="*" >
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#ffffff"
android:padding="5dp" >
<TextView
style="@style/leftColumn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Branche" />
<TextView
android:id="@+id/textViewBranche"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/rightColumn"
android:text="Branche"
/>
</TableRow>
</TableLayout>
styles.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<!-- ... -->
<style name="leftColumn">
<item name="android:background">#2B60DE</item>
<item name="android:textColor">#ffffff</item>
</style>
<style name="rightColumn">
<item name="android:background">#C0C0C0</item>
<item name="android:textColor">#ffffff</item>
</style>
</resources>
#2B60DE
#ffffff
#C0C0C0
#ffffff
如果我运行我的应用程序,它如下所示:
如您所见,仅显示一个文本视图。我希望表格布局有两列(就像预览中一样)。第一个(蓝色)指示正在显示的内容,第二个(灰色)指示适配器提供的信息。但是,我只看到适配器提供的信息(在本例中为“sonstige(others)”,所以基本上我只看到右边的列。
我不知道为什么我看不到第一个文本视图(分别是第一行)的内容。
我使用了一些属性,比如布局宽度和布局高度,但它们没有改变
我正在S3上运行此应用程序
任何帮助都将不胜感激
干杯我不确定它是否导致了这个问题,但是你的文本视图应该有一个
android:layout\u width
和android:layout\u height
集。我更新了上面的代码。不幸的是,问题仍然是一样的。我很困惑,因为至少我希望看到第一个文本视图。