我的 recyclerviews 的项目中没有文字

There is not text in the items of my recyclerviews

我正在创建一个基于 recyclerview 的项目。我创建了一个 Adapter class,其中包含 ViewHolder,我还创建了名为 ListItems 的模型 Class。当我尝试 运行 应用程序时,在完成所有其他操作后,它显示了所有 cardView,但没有文本显示在它们上面。这些是我拥有的不同 classes 和布局的代码。

这是我命名为 homeCardAdapter

的适配器Class
public class homeCardAdapter extends RecyclerView.Adapter<homeCardAdapter.ViewHolder> {

private List<ListItems> listItems;
private Context context;

public homeCardAdapter(List<ListItems> listItems, Context context) {
    this.listItems = listItems;
    this.context = context;
}

@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View v = LayoutInflater.from(parent.getContext())
            .inflate(R.layout.cardview_home, parent, false);

    return new ViewHolder(v);
}

@Override
public void onBindViewHolder(ViewHolder holder, int position) {
    ListItems listItem = listItems.get(position);
    holder.cardHead.setText(listItem.getTitle());
    holder.cardDesc.setText(listItem.getDesc());
    holder.pay.setText(listItem.getPay());
}

@Override
public int getItemCount() {
    return listItems.size();
}

public class ViewHolder extends RecyclerView.ViewHolder{

    public TextView cardHead, cardDesc, pay;
    public ViewHolder(View itemView) {
        super(itemView);

        cardHead = itemView.findViewById(R.id.companyName);
        cardDesc = itemView.findViewById(R.id.cardDescription);
        pay = itemView.findViewById(R.id.pay);
    }
}
}

这是我名为 ListItems

的模型 class 的代码
public class ListItems {
String title, description, pay;

public ListItems(String title, String description, String pay) {
}

public String getTitle() {
    return title;
}

public String getPay() {
    return pay;
}

public String getDesc() {
    return description;
}

}

这是我命名为 Welcome

的 Java Activity
public class Welcome extends AppCompatActivity {

private static final String TAG = "Welcome";

private RecyclerView recyclerView;
private RecyclerView.Adapter adapter;

private List<ListItems> listItems;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_welcome);
    Log.d(TAG, "onCreate: starting");

    recyclerView = findViewById(R.id.recyclerView);
    recyclerView.setHasFixedSize(true);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));

    listItems = new ArrayList<>();

    for (int i = 0 ; i < 10; i++){
        ListItems listItem = new ListItems(
                "Port Organization" + (i+1),
                "Lorem Ipsum The Description Will Go over Here So As for case" + (i),
                "250" + (i) + "/ Week"
        );
        listItems.add(listItem);
    }

    adapter = new homeCardAdapter(listItems,this);

    recyclerView.setAdapter(adapter);
}
}

这是我在 RecyclerView 中使用的 CardView

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <TextView
            android:id="@+id/pay"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="#000"
            android:text="0 / Week"
            android:textColor="#FFF"
            android:layout_marginStart="20dp"
            android:layout_marginTop="20dp"
            android:paddingTop="5dp"
            android:paddingBottom="5dp"
            android:paddingEnd="10dp"
            android:paddingStart="10dp"
            android:textSize="18sp"/>
        <TextView
            android:id="@+id/companyName"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Company Name"
            android:layout_below="@id/pay"
            android:textSize="22sp"
            android:textColor="#000"
            android:layout_marginTop="10dp"
            android:layout_marginStart="20dp"
            />
        <TextView
            android:id="@+id/cardDescription"
            android:layout_width="220dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="20dp"
            android:layout_marginTop="10dp"
            android:text="Lorem Ipsum Some Text Goes Over Here"
            android:layout_below="@id/companyName"/>


    </RelativeLayout>

</android.support.v7.widget.CardView>

请建议我进行编辑,以便我可以将文本添加到我的卡片中。

你没有在你的构造函数中初始化值,像这个构造函数一样使用

public ListItems(String title, String description, String pay) {
this.title = title;
this.description= description;
this.pay= pay;
}