gpt4 book ai didi

android - 回收站 View 未在布局中显示任何内容

转载 作者:行者123 更新时间:2023-11-29 15:04:03 31 4
gpt4 key购买 nike

<分区>

我正在使用回收站 View ,但它没有显示任何内容。

我的代码

回收者观点:

<android.support.v7.widget.RecyclerView
android:id="@+id/rv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>

主要 Activity :

 recyclerView=(RecyclerView)findViewById(R.id.rv);
RecyclerViewLayoutManager=new LinearLayoutManager(getApplicationContext());
recyclerView.setLayoutManager(RecyclerViewLayoutManager);
RecyclerView.Adapter adapter=new RecyclerViewAdapter(data,dataname,dataid,datamyname);

recyclerView.setAdapter(adapter);

Recyclerview 适配器:

public class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewAdapter.ViewHolder> {


ArrayList<String> data;
ArrayList<String>dataname;
ArrayList<String>dataid;
ArrayList<String>datamyname;

View view1;
String tempname;


public RecyclerViewAdapter(ArrayList<String> data1,ArrayList<String> data2,ArrayList<String>data3,ArrayList<String>data4) {
this.data = data1;
this.dataname = data2;
this.dataid = data3;
this.datamyname = data4;
}

@Override
public RecyclerViewAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
view1= LayoutInflater.from(parent.getContext()).inflate(R.layout.cardview,parent,false);
return new ViewHolder(view1);

}

@Override
public void onBindViewHolder(RecyclerViewAdapter.ViewHolder holder, int position) {
holder.tv1.setText(data.get(position));
holder.tv2.setText(dataname.get(position));
tempname=dataid.get(position);
//imag=(ImageView)holder.findViewById(R.id.imageView2);

}

@Override
public int getItemCount() {
return 0;
}

public class ViewHolder extends RecyclerView.ViewHolder{
TextView tv1,tv2,copy,share;
ImageView imag;
public ViewHolder(View itemView) {
super(itemView);
tv1=(TextView)itemView.findViewById(R.id.eventtitle);
tv2=(TextView)itemView.findViewById(R.id.textView5);
imag=(ImageView)itemView.findViewById(R.id.imageView2);
Glide.with(MyApp.getContext()).load(tempname).into(imag);
}
}
}

<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="450dp"
xmlns:tools="http://schemas.android.com/tools"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:paddingBottom="4dp"
android:paddingTop="4dp"
card_view:contentPadding="4dp"
card_view:cardElevation="4dp"
android:id="@+id/card"
card_view:cardCornerRadius="20dp"
tools:context=".BloodDonationHealth">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="400dp"
android:id="@+id/rl">


<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Title"
android:id="@+id/eventtitle"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Description W/khrn_client t.GattService: clientConnect() - tion of void com.yolo.music.YoloInitManager.onApplicationCreate(android.app.Application) took 274.353ms 11-01 11:41:43.087 507-1096/system_process W/art: Long monitor contention event with owner maddress=08:7C:BE:52:00:56, isDirect=false t.GattService: clientConnect() - address=08:7C:BE:52:00:56, isDirect=false init_window window 0x484b3038, 480x800 hintTransform 0x0 do_pre 1 10-31 20:21:04.481 1777-1790/bootcamplearning.humanplanet I/art: Background sticky concurrent mark sweep GC freed 40216(2MB) AllocSpace objects, 2(32KB) LOS objects, 4% free, 26MB/27MB, paused 5."
android:id="@+id/textView5"
android:layout_gravity="left|center_vertical"
android:layout_below="@+id/imageView2"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<ImageView
android:layout_width="match_parent"
android:layout_height="120dp"
android:id="@+id/imageView2"
android:src="@drawable/globe"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="36dp" />

</RelativeLayout>




<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_gravity="bottom">

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView3"
android:src="@drawable/location" />

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView4"
android:src="@drawable/user"/>

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/share"
android:id="@+id/imageView5" />

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView6"
android:src="@drawable/chat"/>
</LinearLayout>
</android.support.v7.widget.CardView>

</RelativeLayout>

这是我的代码,我无法配置出了什么问题,有人可以帮我解决这个问题吗?我哪里做错了,你能告诉我吗

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