我有这样的东西:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TableRow
android:id="@+id/tableRow1"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/chooseBirthDateText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="25dp"
style="@style/mediumText"
android:gravity="center_horizontal"
android:text="@string/choose_birth_date" />
</TableRow>
</TableLayout>
</ScrollView>
我想添加更多行,但只能在一段时间后(假设 10 秒)。我想首先让这些行不可见,然后再让它们出现。但这样我的 ScrollView 就不能按我想要的方式工作(即使下面没有任何东西,我也可以向下滚动 - 因为行是不可见的)
所以我想在第二个文件中添加我想要添加的行,在中间加载它们并在它们必须出现时将它们添加到 tableRow1 之后。不幸的是我不知道如何做到这一点(我正在谈论连接 2 个文件,而不是在 java 中创建第二个文件):/
最佳答案
有两种隐藏 View 的模式:
INVISIBLE
:此 View 不可见,但出于布局目的,它仍然占用空间。GONE
:此 View 不可见,并且不占用任何布局空间。
http://developer.android.com/reference/android/view/View.html#setVisibility(int)
我认为GONE
会对您有所帮助。
关于java - 将行动态添加到单独文件中的表布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14831906/