I am developing an Android app and I created a TableLayout to display some information, but the table I created has a grey divider between the table header and the rest of the rows that gets bigger the more records there are on the table.
This is how the table looks with 20~ rows
I just created a TableLayout inside of some other containers like so:
FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".fragmentos.TablaAsig">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical">
<TableLayout
android:id="@+id/tablaSinAsig"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="40dp"
android:divider="?android:listDivider"
android:paddingBottom="60dp"
android:showDividers="middle">
<!-- Header de la tabla -->
<TableRow
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="@android:color/holo_red_dark"
android:padding="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="15dp"
android:text="Asignatu gabeko TAG-ak" />
</TableRow>
</TableLayout>
</LinearLayout>
</HorizontalScrollView>
</LinearLayout>
</ScrollView>
</FrameLayout>
And I have a function that creates new TableRows to insert into this TableLayout:
public void poblarTablaSinAsig(Context context, TableLayout tableLayout){
tagsSinAsig = new ArrayList<String>();
SQLiteDatabase db = this.getWritableDatabase();
int filas = tableLayout.getChildCount();
for (int i = 1; i < filas; i++) {
View child = tableLayout.getChildAt(i);
if (child instanceof TableRow) ((ViewGroup) child).removeAllViews();
}
for(int i = 0; i < EventHandler.allTagData.size(); i++) {
TableRow nuevoReg = new TableRow(context);
TextView codTag = new TextView(context);
TableRow.LayoutParams parametros = new TableRow.LayoutParams(
TableRow.LayoutParams.MATCH_PARENT,
TableRow.LayoutParams.WRAP_CONTENT
);
parametros.setMargins(50, 15, 10, 15);
nuevoReg.setLayoutParams(parametros);
Cursor cursor = null;
String query = "SELECT * FROM asignaciones WHERE CodigoChip = '" + EventHandler.allTagData.get(i) + "'";
cursor = db.rawQuery(query, null);
if(cursor.getCount() <= 0) {
codTag.setText(EventHandler.allTagData.get(i));
nuevoReg.addView(codTag, parametros);
tableLayout.addView(nuevoReg, parametros);
tagsSinAsig.add(EventHandler.allTagData.get(i));
} else {
tagsAsig.add(EventHandler.allTagData.get(i));
}
}
}
Where is this weird divider being created? How can I solve the problem?