是否可以在 TableLayout 中添加不确定的进度条?
我有一个滚动视图,其中包含 Tablelayout 作为其子视图。现在,当我从服务器接收数据时,我想在屏幕上显示进度条。收到数据后,进度条必须替换为表格行。
我能够部分实现这一点。我将进度条视图添加到第三行(第 1 行和第 2 行是标题),一旦接收到数据并创建表行,该视图的可见性就会消失。
问题是进度条出现在屏幕顶部。为了与应用程序保持一致,进度条必须位于屏幕中间,就像我在 ListView 上一样。
这是进度条的代码片段
`<TableRow
android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center_horizontal">
<ProgressBar
android:id="@+id/list_progressbar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"/>
</TableRow>
I have a scroll view that contains Tablelayout as its Child view. Now while I am receving the data from the server I'd like to display a progress bar on the screen. When the data is received the progress bar must replaced by the tablerows.
I am able to achieve this partially. I add a progressbar view into the 3rd row (row 1 and 2 are headers) which has visibility gone once the data is received and tablerows are created.
The issue is that the progress bar appears at the top of the screen. To be consistent with the app, the progress bar must be in the middle of the screen as I have it on ListViews.
Here is the code snippet for Progressbar
`<TableRow
android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center_horizontal">
<ProgressBar
android:id="@+id/list_progressbar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"/>
</TableRow>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
里面有一个 TableLayout,将所有 TableRows 放入其中,就像我希望您所做的那样,包括带有 ProgressBar 的 TableRows,现在而不是要替换。
您可以通过其他方式实现它,只需将包含 ProgressBar 的 TableRow 的 View.GONE 和要显示的 TableRow 的 View.VISIBLE 即可。
例如;
当您收到数据
时,我希望这对您有用。
谢谢!
Have a TableLayout inside that put all TableRows as I hope you doing, including the one with the ProgressBar, now instead of going to replace.
You can achieve it other way, just make the View.GONE of the TableRow containing ProgressBar, and View.VISIBLE of TableRow which you want to show.
For example;
as you recieve the data
So, I hope this will work for you.
Thanks!