在 android 中的数据列表之间插入文本

Insertion of text between List of data in android

我不知道在 android 中是如何完成的。图片已提供 Its a ux created in html and wanted the same in android。问题是我认为它可以附加在回收站视图中并以这种方式编码:

public class FourFragment extends Fragment {

    RecyclerView rv_notify;
    MyAdapter adapter;
    ArrayList<Player> players=new ArrayList<>();
    TextView notify_count_tv;
    Context c;

    public FourFragment() {
        // Required empty public constructor
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View v = inflater.inflate(R.layout.fragment_four, container, false);
        c=v.getContext();
        notify_count_tv=(TextView) v.findViewById(R.id.profile_notification_count);
        ImageView imageView = (ImageView) v.findViewById(R.id.profile_imageview);
        Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_bank);
        Bitmap blurredBitmap = blur(bitmap);
        imageView.setImageBitmap(blurredBitmap);
        imageView.setScaleType(ImageView.ScaleType.FIT_XY);

        rv_notify= (RecyclerView) v.findViewById(R.id.profile_recyclerView);
        rv_notify.setLayoutManager(new LinearLayoutManager(getContext()));
        rv_notify.setItemAnimator(new DefaultItemAnimator());

        adapter=new MyAdapter(getContext(),players);

        players.clear();
        for(int i=0;i<=6;i++){
            int id=i;
            if(i!=5) {
                String notify = "Your appointment for UI design has been accepted by Subajeeth Mukerjeee";
                String time = "" + i;
                String date = "17 Oct 2016";
                Player p = new Player(id, notify, time, date, R.mipmap.ic_bank);
                players.add(p);
            }else {
                rv_notify.setAdapter(adapter);
                players.clear();
                TextView textView = new TextView(c);
                textView.setText("123");
                String notify = "Your appointment for UI design has been accepted by Subajeeth Mukerjeee";
                String time = "" + i;
                String date = "17 Oct 2016";
                Player p = new Player(id, notify, time, date, R.mipmap.ic_bank);
                players.add(p);
            }
        }

        if(!(players.size()<1)){
            notify_count_tv.setText(""+players.size());
            rv_notify.setAdapter(adapter);
        }

        return v;
    }

    public Bitmap blur(Bitmap image) {
        float BLUR_RADIUS = 23.3f;
        if (null == image) return null;

        Bitmap outputBitmap = Bitmap.createBitmap(image);
        final RenderScript renderScript = RenderScript.create(getContext());
        Allocation tmpIn = Allocation.createFromBitmap(renderScript, image);
        Allocation tmpOut = Allocation.createFromBitmap(renderScript, outputBitmap);

        //Intrinsic Gausian blur filter
        ScriptIntrinsicBlur theIntrinsic = ScriptIntrinsicBlur.create(renderScript, Element.U8_4(renderScript));
        theIntrinsic.setRadius(BLUR_RADIUS);
        theIntrinsic.setInput(tmpIn);
        theIntrinsic.forEach(tmpOut);
        tmpOut.copyTo(outputBitmap);
        return outputBitmap;
    }

}

但视图只打印最后剩余的数据,替换其他数据。 我还尝试在中间插入一个 textview 以获得图像的结果,但是 dat 也失败了。你能帮我制作与android中提供的图像相同的图像吗?

您想将 sticky-headers-recyclerview 用于带有列表的 headers 部分。