Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/193.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何在横向模式下用表格布局填充所有屏幕?_Java_Android_Tablelayout_Android Tablelayout_Landscape Portrait - Fatal编程技术网

Java 如何在横向模式下用表格布局填充所有屏幕?

Java 如何在横向模式下用表格布局填充所有屏幕?,java,android,tablelayout,android-tablelayout,landscape-portrait,Java,Android,Tablelayout,Android Tablelayout,Landscape Portrait,我正在我的应用程序中使用一个表格布局。这是我的XML代码: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" android:scrollbars="none"> <include

我正在我的应用程序中使用一个表格布局。这是我的XML代码:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:scrollbars="none">

<include
    android:id="@id/action_bar"
    layout="@layout/actionbar_toolbar" />

<HorizontalScrollView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@id/action_bar">

    <ScrollView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">

        <TableLayout
            android:id="@+id/table"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">

        </TableLayout>
    </ScrollView>
</HorizontalScrollView>
等等

所有的工作都很好,但我尝试在横向模式下查看表格,问题是表格没有填满所有屏幕。在纵向模式下看起来不错


p.D:
android:shrinkColumns
android:stretchColumns
对我不起作用。

使用匹配父视图进行查看。

使用
fill\u parent
而不是
wrap\u content
对视图的
布局宽度
将android:layout\u width=“匹配父视图”设置为所有三个视图水平滚动视图,滚动视图,TableLayout。这两种方法都不起作用。请尝试分别为横向模式创建布局。但我的表从代码中获取所有值。如果在预览中布局为空,如何仅编辑横向模式?您可以使用与纵向模式相同的视图为横向模式创建布局。请参阅此链接以了解相关信息
   TableRow tbrow = new TableRow(this);
    TextView txt_plazo = new TextView(this);
    txt_plazo.setText(" Plazo ");
    txt_plazo.setTextColor(Color.WHITE);
    txt_plazo.setTextSize(16);
    txt_plazo.setMinimumHeight(0);
    txt_plazo.setBackgroundColor(Color.DKGRAY);
    txt_plazo.setGravity(Gravity.CENTER);
    tbrow.addView(txt_plazo);

    TextView txt_saldoInicial = new TextView(this);
    txt_saldoInicial.setText(" Saldo Inicial");
    txt_saldoInicial.setTextColor(Color.WHITE);
    txt_saldoInicial.setTextSize(16);
    txt_saldoInicial.setBackgroundColor(Color.DKGRAY);
    txt_saldoInicial.setGravity(Gravity.CENTER);
    tbrow.addView(txt_saldoInicial);

    TextView txt_parcialidades = new TextView(this);
    txt_parcialidades.setText(" Parcialidades ");
    txt_parcialidades.setTextColor(Color.WHITE);
    txt_parcialidades.setTextSize(16);
    txt_parcialidades.setBackgroundColor(Color.DKGRAY);
    txt_parcialidades.setGravity(Gravity.CENTER);
    tbrow.addView(txt_parcialidades);

    TextView txt_interes = new TextView(this);
    txt_interes.setText(" Interés ");
    txt_interes.setTextSize(16);
    txt_interes.setBackgroundColor(Color.DKGRAY);
    txt_interes.setGravity(Gravity.CENTER);
    txt_interes.setTextColor(Color.WHITE);
    tbrow.addView(txt_interes);

    TextView txt_total = new TextView(this);
    txt_total.setText(" Abono Capital");
    txt_total.setTextSize(16);
    txt_total.setBackgroundColor(Color.DKGRAY);
    txt_total.setGravity(Gravity.CENTER);
    txt_total.setTextColor(Color.WHITE);
    tbrow.addView(txt_total);

    table.addView(tbrow);
    fillTable();