我想在滚动视图到达结束时在片段中加载更多数据。 我的布局具有带有线性布局的滚动视图我正在动态创建Tex视图和按钮。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:background="@drawable/background">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/txtv"
android:textColor="#ffffff"
android:gravity="center"
android:background="@drawable/booktitle" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/scrollViewid"
android:layout_below="@+id/txtv">
<LinearLayout
android:id="@+id/linearlayoutid"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="vertical"
android:orientation="vertical">
</LinearLayout>
</ScrollView>
</RelativeLayout>
答案 0 :(得分:0)
您需要使用recyclerview
或listview
,滚动视图不适合参考本教程http://developer.android.com/training/material/lists-cards.html并运行此示例应用以更好地理解{{3}因为recyclerview是新的,我建议你使用