Android RecyclerView滚动条不起作用

时间:2018-07-08 08:11:36

标签: android android-recyclerview scrollbar

RecyclerView中的滚动条不起作用,我的意思是我可以触摸滚动RecyclerView,也可以看到滚动条,但是它不能移动

在问这个问题之前,我在这里也尝试了一些答案,例如: https://www.dev2qa.com/android-recyclerview-horizontal-scroll-example/

Android RecyclerView Scroll not working after Layout edit

但是他们都不适合我

下面是我的代码,谢谢!

布局文件

     <?xml version="1.0" encoding="utf-8"?>
<ScrollView 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:id="@+id/container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".HexViewActivity">

       <android.support.v7.widget.RecyclerView
            android:id="@+id/rv_hex"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:fadeScrollbars="false"

            android:scrollbarSize="15dp"
            android:scrollbars="vertical" />

</ScrollView>

创建视图的代码

RecyclerView recyclerView = findViewById(R.id.rv_hex);
recyclerView.setLayoutManager(new LinearLayoutManager(HexConstant.app_ontext));
m_fileDataAdapter = new FileDataAdapter(HexConstant.app_ontext, files[0]);
                                        recyclerView.setAdapter(m_fileDataAdapter);
recyclerView.setNestedScrollingEnabled(true);

是否有Scrollbar + recyclerView的示例,请告诉我

2 个答案:

答案 0 :(得分:0)

使用滚动视图布局更改外部布局。

<?php
if(isset($_POST['check_list'])){
  if (is_array($_POST['check_list'])) {
    foreach($_POST['check_list'] as $selected){
     $q=mysqli_query($dbc,"INSERT INTO students (attendance) VALUES ('".$selected."')");
    }
  } else {
      echo "nothing checked";
  }
}
?>

答案 1 :(得分:0)

您是否尝试过使用def rec(nums, target, lower, upper): if (lower > upper): return lower mid = int((upper + lower) / 2) if (nums[mid] > target): return rec(nums,target,lower,mid-1); elif (nums[mid] < target): return rec(nums,target,mid+1,upper); else: return mid class Solution: def searchInsert(self, nums, target): """ :type nums: List[int] :type target: int :rtype: int """ return(rec(nums, target, 0,len(nums)-1)); 的属性RecyclerView? 在此处查看完整答案。 https://stackoverflow.com/a/46026362/6455501