Не получается сделать нормальную прокрутку рядов таблицы. При герерации 100 рядов полоса прокртки охватывает от 39 до 99 ряда. Прошу помочь
activity_main.xml:
Код: Выделить всё
<RelativeLayout 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=".MainActivity" >
<ScrollView
android:id="@+id/tab2"
android:scrollbars="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_marginTop="5dp"
android:fillViewport="true" >
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tlCat1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:shrinkColumns="1"
android:stretchColumns="1" >
</TableLayout>
</ScrollView>
Код: Выделить всё
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TableLayout tlCat1 = (TableLayout)findViewById(R.id.tlCat1);
for (int i = 0; i<100; i++) {
TableRow trCat1 = new TableRow(this);
TableLayout.LayoutParams trParams = new TableLayout.LayoutParams(TableLayout.LayoutParams.FILL_PARENT, TableLayout.LayoutParams.WRAP_CONTENT);
trParams.setMargins(10, 2, 10, 2);
trCat1.setLayoutParams(trParams);
TextView tv = new TextView(this);
tv.setText(Integer.toString(i));
trCat1.addView(tv);
tlCat1.addView(trCat1);
}
}

