gpt4 book ai didi

android - 如何在 android 中使用显示存储在 sqlite 中的数据的 ListView 创建底部 View

转载 作者:行者123 更新时间:2023-11-30 00:53:36 24 4
gpt4 key购买 nike

我正在创建一个应用程序,我想知道是否可以在底部工作 TableView 中显示 ListView 。如果可以,任何人都可以告诉我该怎么做,因为我在底页仅显示共享选项。 谁能告诉我是否有任何与此底页相关的示例

最佳答案

是的,您可以在 Bottom sheet View 中实现 Listview 。首先,您需要为 Bottom sheet 创建 xml 布局,并定义 Listview。

bottom_sheet_layout.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout

xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center|top"
app:layout_behavior="@string/bottom_sheet_behavior"

>
<ListView
android:id="@+id/bottom_sheet_listview"
android:layout_width="match_parent"
android:layout_height="match_parent"></ListView>
</LinearLayout>

在您的 Activity 中定义 BottomSheetDialog。

         BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(TagSetupActivity.this);
View bottomSheetView = getLayoutInflater().inflate(R.layout.bootom_sheet_layout, null);
bottomSheetDialog.setContentView(bottomSheetViewVideo);
bottomSheetDialog.show();
ListView sheetListView= (ListView) bottomSheetView.findViewById(R.id.bottom_sheet_listview);

**and setadapter with data**
//**dataList == data fecth from sqlite.**

adapter=new BottomSheetListAdapter(this,dataList);
sheetListView.setAdapter(adapter);

现在,创建 BaseAdapter 以使用 BottomSheetListAdapter 将数据显示到列表名称中

关于android - 如何在 android 中使用显示存储在 sqlite 中的数据的 ListView 创建底部 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40542393/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com