问题描述
我有一个布局,我希望所有本地音频文件都显示在其recyclerview中:
the local songs should be displayed in the green border
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
tools:context=".MainActivity">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/image_view_background"
android:background="@drawable/background_songbook"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintLeft_toLeftOf="parent"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@+id/bottom_navigation"
app:layout_constraintTop_toBottomOf="@+id/image_view_background"
tools:listitem="@layout/item_song"/>
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottom_navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:itemIconTint="@drawable/navigation_selected_color"
app:itemTextColor="@drawable/navigation_selected_color"
app:menu="@menu/bottom_navigation_menu"
app:itemBackground="@android:color/black"/>
</androidx.constraintlayout.widget.ConstraintLayout>
我尝试使用实现'com.github.jaiselrahman:FilePicker:1.3.2',所以在我的Activity中,我有这个:
private void showLocalSongsOnRecyclerView() {
Intent intent = new Intent(this,FilePickerActivity.class);
intent.putExtra(FilePickerActivity.CONFIGS,new Configurations.Builder()
.setCheckPermission(true)
.setShowAudios(true)
.setShowImages(false)
.setShowVideos(false)
.setShowFiles(false)
.setSingleClickSelection(true)
.setSkipZeroSizeFiles(true)
.build());
startActivityForResult(intent,REQUEST_CODE_LOCAL_SONG_PICKED);
}
当我尝试获取所有音频文件数据时,这将显示一个新活动中的所有音频文件,以便可以在我的自定义RecyclerView中显示每个音频文件。例如:
每个recyclerview行看起来像: 标题艺术家按钮
有什么方法可以获取所有本地音频文件,而不是在新活动中显示它们?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)