首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >滚动问题-当我向上移动滚动条时不回滚

滚动问题-当我向上移动滚动条时不回滚
EN

Stack Overflow用户
提问于 2020-12-28 10:12:05
回答 1查看 71关注 0票数 1

我正在实现回收视图和卡视图在Xamarin android的通知用户界面xml。我感到困惑的是,当我运行我的代码时,它工作得很清楚,但是当我向上滚动时,它会在一个通知与另一个通知之间产生很大的距离。这是主要活动的代码和输出的屏幕截图。

代码语言:javascript
复制
using Android.OS;
using Android.Support.V7.App;
using Android.Runtime;
using Android.Widget;
using Android.Support.V7.Widget;
using App22.Helper;
using System;
using System.Collections.Generic;
namespace App22
{
    [Activity(Label = "@string/app_name", Theme = "@style/Theme.AppCompat.Light.NoActionBar", MainLauncher = true)]
    public class MainActivity : AppCompatActivity
    {
        private RecyclerView recycler;
        private RecyclerViewAdapter adapter;
        private RecyclerView.LayoutManager layoutManager;
        private List<Data> lstData = new List<Data>();

        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_main);

            InitData();

            recycler = FindViewById<RecyclerView>(Resource.Id.recyclerView_Notifications);
            recycler.HasFixedSize = true;
              //layoutManager = new LinearLayoutManager(this);
            layoutManager = new GridLayoutManager(this, 1, GridLayoutManager.Vertical, false);
            recycler.SetLayoutManager(layoutManager);
            adapter = new RecyclerViewAdapter(lstData);
            recycler.SetAdapter(adapter);
        }
        private void InitData()
        {
            lstData.Add(new Data()
            {
                userProfile = "you can write here base 64 string of image",
                issueInfo="abc",
                tvtime_noti="24m",
                userName="Nabeel"
            }) ;
            lstData.Add(new Data()
            {
                userProfile = "you can write here base 64 string of image",
                issueInfo = "abc",
                tvtime_noti = "24m",
                userName = "Nabeel"
            });
            lstData.Add(new Data()
            {
                userProfile = "you can write here base 64 string of image",
                issueInfo = "abc",
                tvtime_noti = "24m",
                userName = "Nabeel"
            });
            lstData.Add(new Data()
            {
                userProfile = "you can write here base 64 string of image"
                issueInfo = "abc",
                tvtime_noti = "24m",
                userName = "Nabeel"
            });

如果您想下载并检查它,这里还有一个github链接。屏幕截图给你更好的信息。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-12-28 11:42:39

notification_items.xml中的android:layout_height="match_parent“行设置为wrap_content

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65475965

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档