Hi I want to skip some items from recyclerview
.
Here is the bit of code
item_Data.xml
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_marginTop="10dp"
android:id="@+id/mainlayout"
android:layout_height="wrap_content">
<ImageView
android:visibility="gone"
android:id="@id/image"
android:layout_gravity="center"
android:layout_width="100dp"
android:layout_height="100dp" />
<TextView
android:visibility="gone"
android:textStyle="bold"
android:id="@id/title"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:maxLength="15" />
And recycler view is
@Override
public void onBindViewHolder(final MovieViewHolder holder, final int position) {
String download= news.get((position)).getDownloadLinkForApkNew();
String desc_new = news.get(position).getApkJData();
if (download.isEmpty()==false && desc_new.isEmpty()==false) {
holder.movieTitle.setVisibility(View.VISIBLE);
holder.imageView.setVisibility(View.VISIBLE);
Picasso.with(context).load(news.get((position)).getBetterFeaturedImage().getSourceUrl()).into(holder.imageView);
holder.movieTitle.setText(news.get(position).getTitle().getRendered());
}
I don't want the items that doesn't have download and desc_new. My logic works items are not visible but they leave there space. how can I remove the spaces between the items.
LinearLayout
for each item of the RecyclerView ? – Ppiif (download.isEmpty()==true && desc_new.isEmpty()==true) { remove this item from array list }
– Collage