Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/230.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/9/silverlight/4.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
Android自动缩减数据表_Android_Android Tablelayout - Fatal编程技术网

Android自动缩减数据表

Android自动缩减数据表,android,android-tablelayout,Android,Android Tablelayout,我是Android新手,我用以下方法制作了一张桌子: <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/question_list" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="5dp"

我是Android新手,我用以下方法制作了一张桌子:

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/question_list"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:padding="5dp"
     android:orientation="vertical"
     android:layout_below="@+id/textView7"
     android:layout_alignParentLeft="true"
     android:layout_alignParentStart="true"
     android:layout_above="@+id/linearLayout">
</TableLayout>

添加了行,它完美地显示了表格。现在我想实现一个搜索框,在我键入时减少结果,我不知道如何做到这一点。我试着搜索,也许我错过了搜索的术语。有人能给它添加一个链接和/或告诉我一些技巧吗,因为重新填充表中某人键入的所有内容是一件坏事


PS:数据以JSON的形式从API发送,我拥有API。

在TableLayout中显示大量信息是不好的做法。您可以使用ListView。因为,每次在搜索框中更改文本时,都需要清除TableLayout中的所有视图,然后需要创建适合搜索过滤器的行,然后需要再次将这些行添加到TableLayout中。创建许多视图并在屏幕上绘制它们对于Android来说是一个艰难的过程,它会使你的应用程序崩溃。

在TableLayout中显示大量信息是一种糟糕的做法。您可以使用ListView。因为,每次在搜索框中更改文本时,都需要清除TableLayout中的所有视图,然后需要创建适合搜索过滤器的行,然后需要再次将这些行添加到TableLayout中。创建许多视图并在屏幕上绘制它们对于Android来说是一个艰难的过程,它会使你的应用程序崩溃