0
我有一个ScrollView
布局与TableLayout
其中我有一个TableRow
它由三个TextViews
组成。scrollview与tablelayout和线性布局
当我尝试将TextViews
与屏幕对齐时,问题就出现了。 TextViews
不占用屏幕的空间和种类。
我重视的代码太多,如果你们需要对其进行审核......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_reciept"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.spuck.LayoutTable">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/relativeLayout">
<ImageView
android:layout_width="wrap_content"
android:layout_height="49dp"
android:src="@drawable/the_one_3"
android:id="@+id/the_one"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</RelativeLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="300dp"
android:id="@+id/scrollView2"
android:layout_below="@+id/relativeLayout"
android:layout_above="@+id/addButton">
<TableLayout
android:id="@+id/maintable"
android:layout_width="match_parent"
android:layout_height="300dp">
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/tableRow1">
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="@+id/linear_layout_two_table_layout">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Date"
android:textAlignment="center"
android:textSize="20dp"
android:layout_weight="0.5"
android:background="@drawable/cell_shape"
/>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Session Time"
android:textSize="20dp"
android:layout_weight="1"
android:background="@drawable/cell_shape"
/>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Average Speed"
android:layout_gravity="center"
android:textSize="20dp"
android:layout_weight="1"
android:background="@drawable/cell_shape"
/>
</LinearLayout>
</TableRow>
</TableLayout>
</ScrollView>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/addButton"
android:text="Scan item barcode"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</RelativeLayout>
我会试试这个肯定的,现在我已经进入另一个概率,我最终在这个布局中添加了一个导航菜单和一个底部导航栏,现在它并没有向我显示表格。任何想法? –
对不起,没有源代码,很难分辨出问题所在。我试图根据这个教程实现底部导航栏https://medium.com/@hitherejoe/exploring-the-android-design-support-library-bottom-navigation-drawer-548de699e8e0#.4bvk8trr4对我来说,它的工作结果如下:https://postimg.org/image/n1gjcalm7/没有添加导航菜单,但它不应该破坏表格。如果你仍然有问题,我认为你应该发布一个新的问题。 – Sabriael
让我们聊聊吧,我是新来的StackOverflow,所以请先给我发消息,如果可以的话 –