2017-04-09 7 views
0

こんにちは、API 21で上手く表示されるテーブルレイアウトがありますが、残念ながらAPI 15でアプリケーションを実行しようとすると、行が空白になり、完全に伸びてしまい、スクロールしていますが、テーブル上に何かアイデアは何も見えませんか?ご協力ありがとうございました!TableLayout API 15で正しく表示されない

XML:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" android:layout_height="match_parent" 
android:background="#3d455b"> 

<ScrollView 
    android:id="@+id/scrollView" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_alignParentLeft="true" > 

<HorizontalScrollView 
    android:id="@+id/hscrll1" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" > 

    <RelativeLayout 
     android:id="@+id/RelativeLayout1" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:orientation="vertical" > 

<TableLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:id="@+id/entries" 
    android:stretchColumns="*"> 

    <TableRow android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/row_cell"> 
    </TableRow> 

</TableLayout> 
    </RelativeLayout> 
</HorizontalScrollView> 
</ScrollView> 
</RelativeLayout> 

JAVA:

valuesTable.removeAllViews(); 

//add header 
     TableRow tbrow0 = new TableRow(ctx); 
     tbrow0.setLayoutParams(new LayoutParams(
       LayoutParams.MATCH_PARENT, 
       LayoutParams.WRAP_CONTENT)); 
     TextView tv0 = new TextView(ctx); 
     tv0.setText("Id"); 
     tv0.setTextSize(20); 
     tv0.setTextColor(Color.WHITE); 
     tv0.setPadding(10, 10, 10, 10); 
     tbrow0.addView(tv0); 
     TextView tv0 = new TextView(ctx); 
     tv0.setText("name"); 
     tv0.setTextSize(20); 
     tv0.setTextColor(Color.WHITE); 
     tv0.setPadding(10, 10, 10, 10); 
     tbrow0.addView(tv0); 
     TextView tv0 = new TextView(ctx); 
     tv0.setText("color"); 
     tv0.setTextSize(20); 
     tv0.setTextColor(Color.WHITE); 
     tv0.setPadding(10, 10, 10, 10); 
     tbrow0.addView(tv0); 


     valuesTable.addView(tbrow0); 

     //Add row information 

      TableRow tbrow = new TableRow(ctx); 
      tbrow.setLayoutParams(new LayoutParams(
        LayoutParams.MATCH_PARENT, 
        LayoutParams.WRAP_CONTENT)); 
      for(String value : row.getValues()){ 
       TextView t1v = new TextView(ctx);    
       t1v.setText(value); 
       t1v.setTextSize(17); 
       t1v.setTextColor(getResources().getColor(R.color.darkgray)); 
       t1v.setPadding(10, 10, 10, 10); 
       t1v.setGravity(Gravity.CENTER); 
       tbrow.addView(t1v); 
      } 

      valuesTable.addView(tbrow); 

答えて

0

スクロールビュー内の相対的なレイアウトを削除するには、古いAPIのトリックをしました。

関連する問題