In android application RecyclerView view show only half of the phone with
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
Here in my activity_main.xml|
in my android RecyclerView show only half of the screen, I'm not able to find out the mistake. Help me guys. I was used different layout like relativelayout, constraintlayout, linearlayout. but I was getting only half of the screen RecyclerView with size.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<android.support.v7.widget.SearchView
android:id="@+id/search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimaryDark"
android:focusable="false"
android:visibility="gone"
app:iconifiedByDefault="false"
app:queryHint="Search Distributors..." />
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_below="@+id/search"
android:layout_centerInParent="true"
android:layout_height="match_parent" />
<Button
android:id="@+id/btnGet"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_alignParentBottom="true"
android:text="get" />
</RelativeLayout>
Here I attach my MainActivity.java
package com.example.admin.recyclerview;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.SearchView;
import android.view.View;
import android.widget.Button;
import com.google.gson.Gson;
import java.util.ArrayList;
import java.util.List;
public class MainActivity extends AppCompatActivity {
private List<Model> models;
RecyclerView recyclerView;
private RecyclerView.LayoutManager layoutManager;
public SearchView searchView;
private Button button;
private RecyclerViewAdapter recyclerViewAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
recyclerView = findViewById(R.id.recyclerView);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
searchView = findViewById(R.id.search);
button = findViewById(R.id.btnGet);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
List<Model> models1 = recyclerViewAdapter.getList();
System.out.println("final order list "+new Gson().toJson(models1));
}
});
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
return false;
}
@Override
public boolean onQueryTextChange(String newText) {
if (recyclerViewAdapter != null) {
recyclerViewAdapter.getFilter().filter(newText);
}
return true;
}
});
//recyclerView.setHasFixedSize(true);
models = new ArrayList<>();
models.add(new Model("rajesh"));
models.add(new Model("deva"));
models.add(new Model("merlin"));
models.add(new Model("antony"));
models.add(new Model("giri"));
models.add(new Model("guru"));
System.out.println("get the position " +
models.get(0).getName());
System.out.println("json view "+new Gson().toJson(models));
recyclerViewAdapter = new
RecyclerViewAdapter(getApplicationContext(), models);
recyclerView.setAdapter(recyclerViewAdapter);
}
}
Here i bellow attach my adapter class
public class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewAdapter.MyViewHolder> implements Filterable {
public Context context;
private List<Model> modelList;
private List<Model> myfilterList;
public RecyclerViewAdapter(Context context, List<Model> modelList) {
this.context = context;
this.modelList = modelList;
this.myfilterList = modelList;
}
@NonNull
@Override
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
LayoutInflater layoutInflater = LayoutInflater.from(context);
View view = layoutInflater.inflate(R.layout.recyclerview_items, null);
return new MyViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull MyViewHolder myViewHolder, int i) {
Model model = myfilterList.get(i);
myViewHolder.llMain.setTag(i);
myViewHolder.textView.setText(model.getName());
}
@Override
public int getItemCount() {
return myfilterList.size();
}
@Override
public Filter getFilter() {
return new Filter() {
@Override
protected FilterResults performFiltering(CharSequence constraint) {
String text = constraint.toString();
if (text.isEmpty()) {
myfilterList = modelList;
} else {
ArrayList<Model> filterable = new ArrayList<>();
for (Model model : modelList) {
System.out.println("check equal " + model.getName()
+ " " + text);
if (model.getName().toLowerCase().contains(text)) {
filterable.add(model);
}
}
myfilterList = filterable;
}
FilterResults filterResults = new FilterResults();
filterResults.values = myfilterList;
return filterResults;
}
@Override
protected void publishResults(CharSequence constraint, FilterResults results) {
myfilterList = (ArrayList<Model>) results.values;
notifyDataSetChanged();
}
};
}
class MyViewHolder extends RecyclerView.ViewHolder {
TextView textView;
Button btnAdd, btnMinus;
LinearLayout llMain;
MyViewHolder(@NonNull View itemView) {
super(itemView);
textView = itemView.findViewById(R.id.tvName);
btnAdd = itemView.findViewById(R.id.btnAdd);
btnMinus = itemView.findViewById(R.id.btnMinus);
llMain = itemView.findViewById(R.id.llMain);
btnAdd.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int pos = (Integer) llMain.getTag();
System.out.println("linear layout position details
"+pos);
myfilterList.add(pos+1, new Model("dummy"));
notifyItemChanged(pos+1);
notifyDataSetChanged();
}
});
}
}
public List<Model> getList()
{
return myfilterList;
}
}
Here I bellow attach my item xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/llMain"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/tvName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAlignment="center"
android:textSize="16sp"
android:layout_margin="5dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="@+id/btnAdd"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Add Items"/>
<Button
android:id="@+id/btnMinus"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Add Items"/>
</LinearLayout>
</LinearLayout>

add a comment |
Here in my activity_main.xml|
in my android RecyclerView show only half of the screen, I'm not able to find out the mistake. Help me guys. I was used different layout like relativelayout, constraintlayout, linearlayout. but I was getting only half of the screen RecyclerView with size.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<android.support.v7.widget.SearchView
android:id="@+id/search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimaryDark"
android:focusable="false"
android:visibility="gone"
app:iconifiedByDefault="false"
app:queryHint="Search Distributors..." />
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_below="@+id/search"
android:layout_centerInParent="true"
android:layout_height="match_parent" />
<Button
android:id="@+id/btnGet"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_alignParentBottom="true"
android:text="get" />
</RelativeLayout>
Here I attach my MainActivity.java
package com.example.admin.recyclerview;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.SearchView;
import android.view.View;
import android.widget.Button;
import com.google.gson.Gson;
import java.util.ArrayList;
import java.util.List;
public class MainActivity extends AppCompatActivity {
private List<Model> models;
RecyclerView recyclerView;
private RecyclerView.LayoutManager layoutManager;
public SearchView searchView;
private Button button;
private RecyclerViewAdapter recyclerViewAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
recyclerView = findViewById(R.id.recyclerView);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
searchView = findViewById(R.id.search);
button = findViewById(R.id.btnGet);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
List<Model> models1 = recyclerViewAdapter.getList();
System.out.println("final order list "+new Gson().toJson(models1));
}
});
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
return false;
}
@Override
public boolean onQueryTextChange(String newText) {
if (recyclerViewAdapter != null) {
recyclerViewAdapter.getFilter().filter(newText);
}
return true;
}
});
//recyclerView.setHasFixedSize(true);
models = new ArrayList<>();
models.add(new Model("rajesh"));
models.add(new Model("deva"));
models.add(new Model("merlin"));
models.add(new Model("antony"));
models.add(new Model("giri"));
models.add(new Model("guru"));
System.out.println("get the position " +
models.get(0).getName());
System.out.println("json view "+new Gson().toJson(models));
recyclerViewAdapter = new
RecyclerViewAdapter(getApplicationContext(), models);
recyclerView.setAdapter(recyclerViewAdapter);
}
}
Here i bellow attach my adapter class
public class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewAdapter.MyViewHolder> implements Filterable {
public Context context;
private List<Model> modelList;
private List<Model> myfilterList;
public RecyclerViewAdapter(Context context, List<Model> modelList) {
this.context = context;
this.modelList = modelList;
this.myfilterList = modelList;
}
@NonNull
@Override
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
LayoutInflater layoutInflater = LayoutInflater.from(context);
View view = layoutInflater.inflate(R.layout.recyclerview_items, null);
return new MyViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull MyViewHolder myViewHolder, int i) {
Model model = myfilterList.get(i);
myViewHolder.llMain.setTag(i);
myViewHolder.textView.setText(model.getName());
}
@Override
public int getItemCount() {
return myfilterList.size();
}
@Override
public Filter getFilter() {
return new Filter() {
@Override
protected FilterResults performFiltering(CharSequence constraint) {
String text = constraint.toString();
if (text.isEmpty()) {
myfilterList = modelList;
} else {
ArrayList<Model> filterable = new ArrayList<>();
for (Model model : modelList) {
System.out.println("check equal " + model.getName()
+ " " + text);
if (model.getName().toLowerCase().contains(text)) {
filterable.add(model);
}
}
myfilterList = filterable;
}
FilterResults filterResults = new FilterResults();
filterResults.values = myfilterList;
return filterResults;
}
@Override
protected void publishResults(CharSequence constraint, FilterResults results) {
myfilterList = (ArrayList<Model>) results.values;
notifyDataSetChanged();
}
};
}
class MyViewHolder extends RecyclerView.ViewHolder {
TextView textView;
Button btnAdd, btnMinus;
LinearLayout llMain;
MyViewHolder(@NonNull View itemView) {
super(itemView);
textView = itemView.findViewById(R.id.tvName);
btnAdd = itemView.findViewById(R.id.btnAdd);
btnMinus = itemView.findViewById(R.id.btnMinus);
llMain = itemView.findViewById(R.id.llMain);
btnAdd.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int pos = (Integer) llMain.getTag();
System.out.println("linear layout position details
"+pos);
myfilterList.add(pos+1, new Model("dummy"));
notifyItemChanged(pos+1);
notifyDataSetChanged();
}
});
}
}
public List<Model> getList()
{
return myfilterList;
}
}
Here I bellow attach my item xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/llMain"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/tvName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAlignment="center"
android:textSize="16sp"
android:layout_margin="5dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="@+id/btnAdd"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Add Items"/>
<Button
android:id="@+id/btnMinus"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Add Items"/>
</LinearLayout>
</LinearLayout>

So you are saying the recyclerView is occupying half of the phone's screen width?
– Imtiaz Abir
Jan 3 at 6:23
Use thisView view=layoutInflater.inflate(R.layout.recyclerview_items,viewGroup,false);
instead of thisView view = layoutInflater.inflate(R.layout.recyclerview_items, null);
– Nilesh Rathod
Jan 3 at 6:37
THANKS for your replay. i was changed all layouts in relative layout. i solve my problem. but i cannot achieve in constraint layout.
– rajesh deva
Jan 3 at 6:54
add a comment |
Here in my activity_main.xml|
in my android RecyclerView show only half of the screen, I'm not able to find out the mistake. Help me guys. I was used different layout like relativelayout, constraintlayout, linearlayout. but I was getting only half of the screen RecyclerView with size.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<android.support.v7.widget.SearchView
android:id="@+id/search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimaryDark"
android:focusable="false"
android:visibility="gone"
app:iconifiedByDefault="false"
app:queryHint="Search Distributors..." />
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_below="@+id/search"
android:layout_centerInParent="true"
android:layout_height="match_parent" />
<Button
android:id="@+id/btnGet"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_alignParentBottom="true"
android:text="get" />
</RelativeLayout>
Here I attach my MainActivity.java
package com.example.admin.recyclerview;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.SearchView;
import android.view.View;
import android.widget.Button;
import com.google.gson.Gson;
import java.util.ArrayList;
import java.util.List;
public class MainActivity extends AppCompatActivity {
private List<Model> models;
RecyclerView recyclerView;
private RecyclerView.LayoutManager layoutManager;
public SearchView searchView;
private Button button;
private RecyclerViewAdapter recyclerViewAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
recyclerView = findViewById(R.id.recyclerView);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
searchView = findViewById(R.id.search);
button = findViewById(R.id.btnGet);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
List<Model> models1 = recyclerViewAdapter.getList();
System.out.println("final order list "+new Gson().toJson(models1));
}
});
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
return false;
}
@Override
public boolean onQueryTextChange(String newText) {
if (recyclerViewAdapter != null) {
recyclerViewAdapter.getFilter().filter(newText);
}
return true;
}
});
//recyclerView.setHasFixedSize(true);
models = new ArrayList<>();
models.add(new Model("rajesh"));
models.add(new Model("deva"));
models.add(new Model("merlin"));
models.add(new Model("antony"));
models.add(new Model("giri"));
models.add(new Model("guru"));
System.out.println("get the position " +
models.get(0).getName());
System.out.println("json view "+new Gson().toJson(models));
recyclerViewAdapter = new
RecyclerViewAdapter(getApplicationContext(), models);
recyclerView.setAdapter(recyclerViewAdapter);
}
}
Here i bellow attach my adapter class
public class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewAdapter.MyViewHolder> implements Filterable {
public Context context;
private List<Model> modelList;
private List<Model> myfilterList;
public RecyclerViewAdapter(Context context, List<Model> modelList) {
this.context = context;
this.modelList = modelList;
this.myfilterList = modelList;
}
@NonNull
@Override
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
LayoutInflater layoutInflater = LayoutInflater.from(context);
View view = layoutInflater.inflate(R.layout.recyclerview_items, null);
return new MyViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull MyViewHolder myViewHolder, int i) {
Model model = myfilterList.get(i);
myViewHolder.llMain.setTag(i);
myViewHolder.textView.setText(model.getName());
}
@Override
public int getItemCount() {
return myfilterList.size();
}
@Override
public Filter getFilter() {
return new Filter() {
@Override
protected FilterResults performFiltering(CharSequence constraint) {
String text = constraint.toString();
if (text.isEmpty()) {
myfilterList = modelList;
} else {
ArrayList<Model> filterable = new ArrayList<>();
for (Model model : modelList) {
System.out.println("check equal " + model.getName()
+ " " + text);
if (model.getName().toLowerCase().contains(text)) {
filterable.add(model);
}
}
myfilterList = filterable;
}
FilterResults filterResults = new FilterResults();
filterResults.values = myfilterList;
return filterResults;
}
@Override
protected void publishResults(CharSequence constraint, FilterResults results) {
myfilterList = (ArrayList<Model>) results.values;
notifyDataSetChanged();
}
};
}
class MyViewHolder extends RecyclerView.ViewHolder {
TextView textView;
Button btnAdd, btnMinus;
LinearLayout llMain;
MyViewHolder(@NonNull View itemView) {
super(itemView);
textView = itemView.findViewById(R.id.tvName);
btnAdd = itemView.findViewById(R.id.btnAdd);
btnMinus = itemView.findViewById(R.id.btnMinus);
llMain = itemView.findViewById(R.id.llMain);
btnAdd.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int pos = (Integer) llMain.getTag();
System.out.println("linear layout position details
"+pos);
myfilterList.add(pos+1, new Model("dummy"));
notifyItemChanged(pos+1);
notifyDataSetChanged();
}
});
}
}
public List<Model> getList()
{
return myfilterList;
}
}
Here I bellow attach my item xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/llMain"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/tvName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAlignment="center"
android:textSize="16sp"
android:layout_margin="5dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="@+id/btnAdd"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Add Items"/>
<Button
android:id="@+id/btnMinus"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Add Items"/>
</LinearLayout>
</LinearLayout>

Here in my activity_main.xml|
in my android RecyclerView show only half of the screen, I'm not able to find out the mistake. Help me guys. I was used different layout like relativelayout, constraintlayout, linearlayout. but I was getting only half of the screen RecyclerView with size.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<android.support.v7.widget.SearchView
android:id="@+id/search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimaryDark"
android:focusable="false"
android:visibility="gone"
app:iconifiedByDefault="false"
app:queryHint="Search Distributors..." />
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_below="@+id/search"
android:layout_centerInParent="true"
android:layout_height="match_parent" />
<Button
android:id="@+id/btnGet"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_alignParentBottom="true"
android:text="get" />
</RelativeLayout>
Here I attach my MainActivity.java
package com.example.admin.recyclerview;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.SearchView;
import android.view.View;
import android.widget.Button;
import com.google.gson.Gson;
import java.util.ArrayList;
import java.util.List;
public class MainActivity extends AppCompatActivity {
private List<Model> models;
RecyclerView recyclerView;
private RecyclerView.LayoutManager layoutManager;
public SearchView searchView;
private Button button;
private RecyclerViewAdapter recyclerViewAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
recyclerView = findViewById(R.id.recyclerView);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
searchView = findViewById(R.id.search);
button = findViewById(R.id.btnGet);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
List<Model> models1 = recyclerViewAdapter.getList();
System.out.println("final order list "+new Gson().toJson(models1));
}
});
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
return false;
}
@Override
public boolean onQueryTextChange(String newText) {
if (recyclerViewAdapter != null) {
recyclerViewAdapter.getFilter().filter(newText);
}
return true;
}
});
//recyclerView.setHasFixedSize(true);
models = new ArrayList<>();
models.add(new Model("rajesh"));
models.add(new Model("deva"));
models.add(new Model("merlin"));
models.add(new Model("antony"));
models.add(new Model("giri"));
models.add(new Model("guru"));
System.out.println("get the position " +
models.get(0).getName());
System.out.println("json view "+new Gson().toJson(models));
recyclerViewAdapter = new
RecyclerViewAdapter(getApplicationContext(), models);
recyclerView.setAdapter(recyclerViewAdapter);
}
}
Here i bellow attach my adapter class
public class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewAdapter.MyViewHolder> implements Filterable {
public Context context;
private List<Model> modelList;
private List<Model> myfilterList;
public RecyclerViewAdapter(Context context, List<Model> modelList) {
this.context = context;
this.modelList = modelList;
this.myfilterList = modelList;
}
@NonNull
@Override
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
LayoutInflater layoutInflater = LayoutInflater.from(context);
View view = layoutInflater.inflate(R.layout.recyclerview_items, null);
return new MyViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull MyViewHolder myViewHolder, int i) {
Model model = myfilterList.get(i);
myViewHolder.llMain.setTag(i);
myViewHolder.textView.setText(model.getName());
}
@Override
public int getItemCount() {
return myfilterList.size();
}
@Override
public Filter getFilter() {
return new Filter() {
@Override
protected FilterResults performFiltering(CharSequence constraint) {
String text = constraint.toString();
if (text.isEmpty()) {
myfilterList = modelList;
} else {
ArrayList<Model> filterable = new ArrayList<>();
for (Model model : modelList) {
System.out.println("check equal " + model.getName()
+ " " + text);
if (model.getName().toLowerCase().contains(text)) {
filterable.add(model);
}
}
myfilterList = filterable;
}
FilterResults filterResults = new FilterResults();
filterResults.values = myfilterList;
return filterResults;
}
@Override
protected void publishResults(CharSequence constraint, FilterResults results) {
myfilterList = (ArrayList<Model>) results.values;
notifyDataSetChanged();
}
};
}
class MyViewHolder extends RecyclerView.ViewHolder {
TextView textView;
Button btnAdd, btnMinus;
LinearLayout llMain;
MyViewHolder(@NonNull View itemView) {
super(itemView);
textView = itemView.findViewById(R.id.tvName);
btnAdd = itemView.findViewById(R.id.btnAdd);
btnMinus = itemView.findViewById(R.id.btnMinus);
llMain = itemView.findViewById(R.id.llMain);
btnAdd.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int pos = (Integer) llMain.getTag();
System.out.println("linear layout position details
"+pos);
myfilterList.add(pos+1, new Model("dummy"));
notifyItemChanged(pos+1);
notifyDataSetChanged();
}
});
}
}
public List<Model> getList()
{
return myfilterList;
}
}
Here I bellow attach my item xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/llMain"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/tvName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAlignment="center"
android:textSize="16sp"
android:layout_margin="5dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="@+id/btnAdd"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Add Items"/>
<Button
android:id="@+id/btnMinus"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Add Items"/>
</LinearLayout>
</LinearLayout>


edited Jan 3 at 7:42


A.H.Nuri
815511
815511
asked Jan 3 at 6:08


rajesh devarajesh deva
356
356
So you are saying the recyclerView is occupying half of the phone's screen width?
– Imtiaz Abir
Jan 3 at 6:23
Use thisView view=layoutInflater.inflate(R.layout.recyclerview_items,viewGroup,false);
instead of thisView view = layoutInflater.inflate(R.layout.recyclerview_items, null);
– Nilesh Rathod
Jan 3 at 6:37
THANKS for your replay. i was changed all layouts in relative layout. i solve my problem. but i cannot achieve in constraint layout.
– rajesh deva
Jan 3 at 6:54
add a comment |
So you are saying the recyclerView is occupying half of the phone's screen width?
– Imtiaz Abir
Jan 3 at 6:23
Use thisView view=layoutInflater.inflate(R.layout.recyclerview_items,viewGroup,false);
instead of thisView view = layoutInflater.inflate(R.layout.recyclerview_items, null);
– Nilesh Rathod
Jan 3 at 6:37
THANKS for your replay. i was changed all layouts in relative layout. i solve my problem. but i cannot achieve in constraint layout.
– rajesh deva
Jan 3 at 6:54
So you are saying the recyclerView is occupying half of the phone's screen width?
– Imtiaz Abir
Jan 3 at 6:23
So you are saying the recyclerView is occupying half of the phone's screen width?
– Imtiaz Abir
Jan 3 at 6:23
Use this
View view=layoutInflater.inflate(R.layout.recyclerview_items,viewGroup,false);
instead of this View view = layoutInflater.inflate(R.layout.recyclerview_items, null);
– Nilesh Rathod
Jan 3 at 6:37
Use this
View view=layoutInflater.inflate(R.layout.recyclerview_items,viewGroup,false);
instead of this View view = layoutInflater.inflate(R.layout.recyclerview_items, null);
– Nilesh Rathod
Jan 3 at 6:37
THANKS for your replay. i was changed all layouts in relative layout. i solve my problem. but i cannot achieve in constraint layout.
– rajesh deva
Jan 3 at 6:54
THANKS for your replay. i was changed all layouts in relative layout. i solve my problem. but i cannot achieve in constraint layout.
– rajesh deva
Jan 3 at 6:54
add a comment |
4 Answers
4
active
oldest
votes
Try changing the RecyclerView
element inside your activity_main.xml
file with the following, remove center_in_parent
and change android:layout_height="wrap_content"
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<android.support.v7.widget.SearchView
android:id="@+id/search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimaryDark"
android:focusable="false"
android:visibility="gone"
app:iconifiedByDefault="false"
app:queryHint="Search Distributors..." />
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_below="@+id/search"
android:layout_height="wrap_content" />
<Button
android:id="@+id/btnGet"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_alignParentBottom="true"
android:text="get" />
</RelativeLayout>
Edit 1 - Using ConstraintLayout
, since after the RecyclerView
you'd also like to display the button, you will need the ConstraintLayout
inside the NestedScrollView
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.SearchView
android:id="@+id/search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
android:background="@color/colorPrimaryDark"
android:focusable="false"
app:iconifiedByDefault="false"
app:queryHint="Search Distributors..." />
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
app:layout_constraintTop_toBottomOf="@+id/search"
android:layout_height="wrap_content" />
<Button
android:id="@+id/btnGet"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_alignParentBottom="true"
android:text="get" />
</android.support.constraint.ConstraintLayout>
</android.support.v4.widget.NestedScrollView>
THANKS for your replay. i was changed all layouts in relative layout. i solve my problem. but i cannot achieve in constraint layout.
– rajesh deva
Jan 3 at 6:55
In ConstraintLayout, changeandroid:layout_height="0dp"
and add these two lines -app:layout_constraintBottom_toBottomOf="parent"
&app:layout_constraintTop_toTopOf="parent"
to achieve the same.
– hsm59
Jan 3 at 7:01
Thanks for your replay. in recyclerview items.xml not correctly positioned when i was using constrained.
– rajesh deva
Jan 3 at 7:39
Give me a moment to update my answer with the solution to your above problem.
– hsm59
Jan 3 at 7:41
1
I've updated the answer, now usesConstraintLayout
to display the search view on the top and button at the bottom after the recyclerView, Hope this helps.
– hsm59
Jan 3 at 8:05
|
show 3 more comments
I don't have privileges to add a comment, hence posting it here. Sorry in advance.
Your question is not quite clear, do you want your RecyclerView
to occupy the whole screen(i.e. parent
). If that's the case, With LinearLayout
I guess if you add an attribute android:layout_weight
in your RecyclerView
will solve the problem.
Here's what the discription for the attribute on developer.android site:
LinearLayout
also supports assigning a weight to individual children with the android:layout_weight
attribute. This attribute assigns an "importance" value to a view in terms of how much space it should occupy on the screen. A larger weight value allows it to expand to fill any remaining space in the parent view. Child views can specify a weight value, and then any remaining space in the view group is assigned to children in the proportion of their declared weight. Default weight is zero.
Hope this link helps https://developer.android.com/guide/topics/ui/layout/linear
Also there's this question already asked by me : What is the connection between setVisibility and layout_weight in Linear Layout
Correct me if I'm wrong.
THANKS for your replay. i was changed all layouts in relative layout. i solve my problem. but i cannot achieve in constraint layout.
– rajesh deva
Jan 3 at 6:54
add a comment |
In your adapter where you are inflating the item in onCreateViewHolder, use this code block:
View rootView = LayoutInflater.from(context).inflate(R.layout.itemLayout, null, false);
RecyclerView.LayoutParams lp = new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
rootView.setLayoutParams(lp);
return new RecyclerViewHolder(rootView);
THANKS for your replay. i was changed all layouts in relative layout. i solve my problem. but i cannot achieve in constraint layout.
– rajesh deva
Jan 3 at 6:54
add a comment |
items.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/llMain"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/tvName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAlignment="center"
android:textSize="16sp"
android:text="fdfsfsdfsd"
android:layout_margin="5dp"/>
<Button
android:id="@+id/btnAdd"
android:layout_width="wrap_content"
android:layout_below="@+id/tvName"
android:layout_height="wrap_content"
android:text="Add Items"/>
<Button
android:layout_below="@+id/tvName"
android:id="@+id/btnMinus"
android:layout_alignParentEnd="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Add Items"/>
</RelativeLayout>
activity_main.xml
<android.support.v7.widget.SearchView
android:id="@+id/search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimaryDark"
android:focusable="false"
android:visibility="visible"
app:iconifiedByDefault="false"
app:queryHint="Search Distributors..." />
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/search" />
<Button
android:id="@+id/btnGet"
android:visibility="visible"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_alignParentBottom="true"
android:text="get" />
</android.support.constraint.ConstraintLayout>
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54017123%2fin-android-application-recyclerview-view-show-only-half-of-the-phone-with%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try changing the RecyclerView
element inside your activity_main.xml
file with the following, remove center_in_parent
and change android:layout_height="wrap_content"
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<android.support.v7.widget.SearchView
android:id="@+id/search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimaryDark"
android:focusable="false"
android:visibility="gone"
app:iconifiedByDefault="false"
app:queryHint="Search Distributors..." />
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_below="@+id/search"
android:layout_height="wrap_content" />
<Button
android:id="@+id/btnGet"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_alignParentBottom="true"
android:text="get" />
</RelativeLayout>
Edit 1 - Using ConstraintLayout
, since after the RecyclerView
you'd also like to display the button, you will need the ConstraintLayout
inside the NestedScrollView
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.SearchView
android:id="@+id/search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
android:background="@color/colorPrimaryDark"
android:focusable="false"
app:iconifiedByDefault="false"
app:queryHint="Search Distributors..." />
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
app:layout_constraintTop_toBottomOf="@+id/search"
android:layout_height="wrap_content" />
<Button
android:id="@+id/btnGet"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_alignParentBottom="true"
android:text="get" />
</android.support.constraint.ConstraintLayout>
</android.support.v4.widget.NestedScrollView>
THANKS for your replay. i was changed all layouts in relative layout. i solve my problem. but i cannot achieve in constraint layout.
– rajesh deva
Jan 3 at 6:55
In ConstraintLayout, changeandroid:layout_height="0dp"
and add these two lines -app:layout_constraintBottom_toBottomOf="parent"
&app:layout_constraintTop_toTopOf="parent"
to achieve the same.
– hsm59
Jan 3 at 7:01
Thanks for your replay. in recyclerview items.xml not correctly positioned when i was using constrained.
– rajesh deva
Jan 3 at 7:39
Give me a moment to update my answer with the solution to your above problem.
– hsm59
Jan 3 at 7:41
1
I've updated the answer, now usesConstraintLayout
to display the search view on the top and button at the bottom after the recyclerView, Hope this helps.
– hsm59
Jan 3 at 8:05
|
show 3 more comments
Try changing the RecyclerView
element inside your activity_main.xml
file with the following, remove center_in_parent
and change android:layout_height="wrap_content"
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<android.support.v7.widget.SearchView
android:id="@+id/search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimaryDark"
android:focusable="false"
android:visibility="gone"
app:iconifiedByDefault="false"
app:queryHint="Search Distributors..." />
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_below="@+id/search"
android:layout_height="wrap_content" />
<Button
android:id="@+id/btnGet"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_alignParentBottom="true"
android:text="get" />
</RelativeLayout>
Edit 1 - Using ConstraintLayout
, since after the RecyclerView
you'd also like to display the button, you will need the ConstraintLayout
inside the NestedScrollView
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.SearchView
android:id="@+id/search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
android:background="@color/colorPrimaryDark"
android:focusable="false"
app:iconifiedByDefault="false"
app:queryHint="Search Distributors..." />
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
app:layout_constraintTop_toBottomOf="@+id/search"
android:layout_height="wrap_content" />
<Button
android:id="@+id/btnGet"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_alignParentBottom="true"
android:text="get" />
</android.support.constraint.ConstraintLayout>
</android.support.v4.widget.NestedScrollView>
THANKS for your replay. i was changed all layouts in relative layout. i solve my problem. but i cannot achieve in constraint layout.
– rajesh deva
Jan 3 at 6:55
In ConstraintLayout, changeandroid:layout_height="0dp"
and add these two lines -app:layout_constraintBottom_toBottomOf="parent"
&app:layout_constraintTop_toTopOf="parent"
to achieve the same.
– hsm59
Jan 3 at 7:01
Thanks for your replay. in recyclerview items.xml not correctly positioned when i was using constrained.
– rajesh deva
Jan 3 at 7:39
Give me a moment to update my answer with the solution to your above problem.
– hsm59
Jan 3 at 7:41
1
I've updated the answer, now usesConstraintLayout
to display the search view on the top and button at the bottom after the recyclerView, Hope this helps.
– hsm59
Jan 3 at 8:05
|
show 3 more comments
Try changing the RecyclerView
element inside your activity_main.xml
file with the following, remove center_in_parent
and change android:layout_height="wrap_content"
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<android.support.v7.widget.SearchView
android:id="@+id/search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimaryDark"
android:focusable="false"
android:visibility="gone"
app:iconifiedByDefault="false"
app:queryHint="Search Distributors..." />
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_below="@+id/search"
android:layout_height="wrap_content" />
<Button
android:id="@+id/btnGet"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_alignParentBottom="true"
android:text="get" />
</RelativeLayout>
Edit 1 - Using ConstraintLayout
, since after the RecyclerView
you'd also like to display the button, you will need the ConstraintLayout
inside the NestedScrollView
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.SearchView
android:id="@+id/search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
android:background="@color/colorPrimaryDark"
android:focusable="false"
app:iconifiedByDefault="false"
app:queryHint="Search Distributors..." />
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
app:layout_constraintTop_toBottomOf="@+id/search"
android:layout_height="wrap_content" />
<Button
android:id="@+id/btnGet"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_alignParentBottom="true"
android:text="get" />
</android.support.constraint.ConstraintLayout>
</android.support.v4.widget.NestedScrollView>
Try changing the RecyclerView
element inside your activity_main.xml
file with the following, remove center_in_parent
and change android:layout_height="wrap_content"
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<android.support.v7.widget.SearchView
android:id="@+id/search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimaryDark"
android:focusable="false"
android:visibility="gone"
app:iconifiedByDefault="false"
app:queryHint="Search Distributors..." />
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_below="@+id/search"
android:layout_height="wrap_content" />
<Button
android:id="@+id/btnGet"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_alignParentBottom="true"
android:text="get" />
</RelativeLayout>
Edit 1 - Using ConstraintLayout
, since after the RecyclerView
you'd also like to display the button, you will need the ConstraintLayout
inside the NestedScrollView
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.SearchView
android:id="@+id/search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
android:background="@color/colorPrimaryDark"
android:focusable="false"
app:iconifiedByDefault="false"
app:queryHint="Search Distributors..." />
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
app:layout_constraintTop_toBottomOf="@+id/search"
android:layout_height="wrap_content" />
<Button
android:id="@+id/btnGet"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_alignParentBottom="true"
android:text="get" />
</android.support.constraint.ConstraintLayout>
</android.support.v4.widget.NestedScrollView>
edited Jan 3 at 8:04
answered Jan 3 at 6:14


hsm59hsm59
1,0821317
1,0821317
THANKS for your replay. i was changed all layouts in relative layout. i solve my problem. but i cannot achieve in constraint layout.
– rajesh deva
Jan 3 at 6:55
In ConstraintLayout, changeandroid:layout_height="0dp"
and add these two lines -app:layout_constraintBottom_toBottomOf="parent"
&app:layout_constraintTop_toTopOf="parent"
to achieve the same.
– hsm59
Jan 3 at 7:01
Thanks for your replay. in recyclerview items.xml not correctly positioned when i was using constrained.
– rajesh deva
Jan 3 at 7:39
Give me a moment to update my answer with the solution to your above problem.
– hsm59
Jan 3 at 7:41
1
I've updated the answer, now usesConstraintLayout
to display the search view on the top and button at the bottom after the recyclerView, Hope this helps.
– hsm59
Jan 3 at 8:05
|
show 3 more comments
THANKS for your replay. i was changed all layouts in relative layout. i solve my problem. but i cannot achieve in constraint layout.
– rajesh deva
Jan 3 at 6:55
In ConstraintLayout, changeandroid:layout_height="0dp"
and add these two lines -app:layout_constraintBottom_toBottomOf="parent"
&app:layout_constraintTop_toTopOf="parent"
to achieve the same.
– hsm59
Jan 3 at 7:01
Thanks for your replay. in recyclerview items.xml not correctly positioned when i was using constrained.
– rajesh deva
Jan 3 at 7:39
Give me a moment to update my answer with the solution to your above problem.
– hsm59
Jan 3 at 7:41
1
I've updated the answer, now usesConstraintLayout
to display the search view on the top and button at the bottom after the recyclerView, Hope this helps.
– hsm59
Jan 3 at 8:05
THANKS for your replay. i was changed all layouts in relative layout. i solve my problem. but i cannot achieve in constraint layout.
– rajesh deva
Jan 3 at 6:55
THANKS for your replay. i was changed all layouts in relative layout. i solve my problem. but i cannot achieve in constraint layout.
– rajesh deva
Jan 3 at 6:55
In ConstraintLayout, change
android:layout_height="0dp"
and add these two lines - app:layout_constraintBottom_toBottomOf="parent"
& app:layout_constraintTop_toTopOf="parent"
to achieve the same.– hsm59
Jan 3 at 7:01
In ConstraintLayout, change
android:layout_height="0dp"
and add these two lines - app:layout_constraintBottom_toBottomOf="parent"
& app:layout_constraintTop_toTopOf="parent"
to achieve the same.– hsm59
Jan 3 at 7:01
Thanks for your replay. in recyclerview items.xml not correctly positioned when i was using constrained.
– rajesh deva
Jan 3 at 7:39
Thanks for your replay. in recyclerview items.xml not correctly positioned when i was using constrained.
– rajesh deva
Jan 3 at 7:39
Give me a moment to update my answer with the solution to your above problem.
– hsm59
Jan 3 at 7:41
Give me a moment to update my answer with the solution to your above problem.
– hsm59
Jan 3 at 7:41
1
1
I've updated the answer, now uses
ConstraintLayout
to display the search view on the top and button at the bottom after the recyclerView, Hope this helps.– hsm59
Jan 3 at 8:05
I've updated the answer, now uses
ConstraintLayout
to display the search view on the top and button at the bottom after the recyclerView, Hope this helps.– hsm59
Jan 3 at 8:05
|
show 3 more comments
I don't have privileges to add a comment, hence posting it here. Sorry in advance.
Your question is not quite clear, do you want your RecyclerView
to occupy the whole screen(i.e. parent
). If that's the case, With LinearLayout
I guess if you add an attribute android:layout_weight
in your RecyclerView
will solve the problem.
Here's what the discription for the attribute on developer.android site:
LinearLayout
also supports assigning a weight to individual children with the android:layout_weight
attribute. This attribute assigns an "importance" value to a view in terms of how much space it should occupy on the screen. A larger weight value allows it to expand to fill any remaining space in the parent view. Child views can specify a weight value, and then any remaining space in the view group is assigned to children in the proportion of their declared weight. Default weight is zero.
Hope this link helps https://developer.android.com/guide/topics/ui/layout/linear
Also there's this question already asked by me : What is the connection between setVisibility and layout_weight in Linear Layout
Correct me if I'm wrong.
THANKS for your replay. i was changed all layouts in relative layout. i solve my problem. but i cannot achieve in constraint layout.
– rajesh deva
Jan 3 at 6:54
add a comment |
I don't have privileges to add a comment, hence posting it here. Sorry in advance.
Your question is not quite clear, do you want your RecyclerView
to occupy the whole screen(i.e. parent
). If that's the case, With LinearLayout
I guess if you add an attribute android:layout_weight
in your RecyclerView
will solve the problem.
Here's what the discription for the attribute on developer.android site:
LinearLayout
also supports assigning a weight to individual children with the android:layout_weight
attribute. This attribute assigns an "importance" value to a view in terms of how much space it should occupy on the screen. A larger weight value allows it to expand to fill any remaining space in the parent view. Child views can specify a weight value, and then any remaining space in the view group is assigned to children in the proportion of their declared weight. Default weight is zero.
Hope this link helps https://developer.android.com/guide/topics/ui/layout/linear
Also there's this question already asked by me : What is the connection between setVisibility and layout_weight in Linear Layout
Correct me if I'm wrong.
THANKS for your replay. i was changed all layouts in relative layout. i solve my problem. but i cannot achieve in constraint layout.
– rajesh deva
Jan 3 at 6:54
add a comment |
I don't have privileges to add a comment, hence posting it here. Sorry in advance.
Your question is not quite clear, do you want your RecyclerView
to occupy the whole screen(i.e. parent
). If that's the case, With LinearLayout
I guess if you add an attribute android:layout_weight
in your RecyclerView
will solve the problem.
Here's what the discription for the attribute on developer.android site:
LinearLayout
also supports assigning a weight to individual children with the android:layout_weight
attribute. This attribute assigns an "importance" value to a view in terms of how much space it should occupy on the screen. A larger weight value allows it to expand to fill any remaining space in the parent view. Child views can specify a weight value, and then any remaining space in the view group is assigned to children in the proportion of their declared weight. Default weight is zero.
Hope this link helps https://developer.android.com/guide/topics/ui/layout/linear
Also there's this question already asked by me : What is the connection between setVisibility and layout_weight in Linear Layout
Correct me if I'm wrong.
I don't have privileges to add a comment, hence posting it here. Sorry in advance.
Your question is not quite clear, do you want your RecyclerView
to occupy the whole screen(i.e. parent
). If that's the case, With LinearLayout
I guess if you add an attribute android:layout_weight
in your RecyclerView
will solve the problem.
Here's what the discription for the attribute on developer.android site:
LinearLayout
also supports assigning a weight to individual children with the android:layout_weight
attribute. This attribute assigns an "importance" value to a view in terms of how much space it should occupy on the screen. A larger weight value allows it to expand to fill any remaining space in the parent view. Child views can specify a weight value, and then any remaining space in the view group is assigned to children in the proportion of their declared weight. Default weight is zero.
Hope this link helps https://developer.android.com/guide/topics/ui/layout/linear
Also there's this question already asked by me : What is the connection between setVisibility and layout_weight in Linear Layout
Correct me if I'm wrong.
answered Jan 3 at 6:30


Mangesh PawarMangesh Pawar
6111
6111
THANKS for your replay. i was changed all layouts in relative layout. i solve my problem. but i cannot achieve in constraint layout.
– rajesh deva
Jan 3 at 6:54
add a comment |
THANKS for your replay. i was changed all layouts in relative layout. i solve my problem. but i cannot achieve in constraint layout.
– rajesh deva
Jan 3 at 6:54
THANKS for your replay. i was changed all layouts in relative layout. i solve my problem. but i cannot achieve in constraint layout.
– rajesh deva
Jan 3 at 6:54
THANKS for your replay. i was changed all layouts in relative layout. i solve my problem. but i cannot achieve in constraint layout.
– rajesh deva
Jan 3 at 6:54
add a comment |
In your adapter where you are inflating the item in onCreateViewHolder, use this code block:
View rootView = LayoutInflater.from(context).inflate(R.layout.itemLayout, null, false);
RecyclerView.LayoutParams lp = new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
rootView.setLayoutParams(lp);
return new RecyclerViewHolder(rootView);
THANKS for your replay. i was changed all layouts in relative layout. i solve my problem. but i cannot achieve in constraint layout.
– rajesh deva
Jan 3 at 6:54
add a comment |
In your adapter where you are inflating the item in onCreateViewHolder, use this code block:
View rootView = LayoutInflater.from(context).inflate(R.layout.itemLayout, null, false);
RecyclerView.LayoutParams lp = new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
rootView.setLayoutParams(lp);
return new RecyclerViewHolder(rootView);
THANKS for your replay. i was changed all layouts in relative layout. i solve my problem. but i cannot achieve in constraint layout.
– rajesh deva
Jan 3 at 6:54
add a comment |
In your adapter where you are inflating the item in onCreateViewHolder, use this code block:
View rootView = LayoutInflater.from(context).inflate(R.layout.itemLayout, null, false);
RecyclerView.LayoutParams lp = new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
rootView.setLayoutParams(lp);
return new RecyclerViewHolder(rootView);
In your adapter where you are inflating the item in onCreateViewHolder, use this code block:
View rootView = LayoutInflater.from(context).inflate(R.layout.itemLayout, null, false);
RecyclerView.LayoutParams lp = new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
rootView.setLayoutParams(lp);
return new RecyclerViewHolder(rootView);
answered Jan 3 at 6:28


Imtiaz AbirImtiaz Abir
376212
376212
THANKS for your replay. i was changed all layouts in relative layout. i solve my problem. but i cannot achieve in constraint layout.
– rajesh deva
Jan 3 at 6:54
add a comment |
THANKS for your replay. i was changed all layouts in relative layout. i solve my problem. but i cannot achieve in constraint layout.
– rajesh deva
Jan 3 at 6:54
THANKS for your replay. i was changed all layouts in relative layout. i solve my problem. but i cannot achieve in constraint layout.
– rajesh deva
Jan 3 at 6:54
THANKS for your replay. i was changed all layouts in relative layout. i solve my problem. but i cannot achieve in constraint layout.
– rajesh deva
Jan 3 at 6:54
add a comment |
items.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/llMain"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/tvName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAlignment="center"
android:textSize="16sp"
android:text="fdfsfsdfsd"
android:layout_margin="5dp"/>
<Button
android:id="@+id/btnAdd"
android:layout_width="wrap_content"
android:layout_below="@+id/tvName"
android:layout_height="wrap_content"
android:text="Add Items"/>
<Button
android:layout_below="@+id/tvName"
android:id="@+id/btnMinus"
android:layout_alignParentEnd="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Add Items"/>
</RelativeLayout>
activity_main.xml
<android.support.v7.widget.SearchView
android:id="@+id/search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimaryDark"
android:focusable="false"
android:visibility="visible"
app:iconifiedByDefault="false"
app:queryHint="Search Distributors..." />
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/search" />
<Button
android:id="@+id/btnGet"
android:visibility="visible"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_alignParentBottom="true"
android:text="get" />
</android.support.constraint.ConstraintLayout>
add a comment |
items.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/llMain"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/tvName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAlignment="center"
android:textSize="16sp"
android:text="fdfsfsdfsd"
android:layout_margin="5dp"/>
<Button
android:id="@+id/btnAdd"
android:layout_width="wrap_content"
android:layout_below="@+id/tvName"
android:layout_height="wrap_content"
android:text="Add Items"/>
<Button
android:layout_below="@+id/tvName"
android:id="@+id/btnMinus"
android:layout_alignParentEnd="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Add Items"/>
</RelativeLayout>
activity_main.xml
<android.support.v7.widget.SearchView
android:id="@+id/search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimaryDark"
android:focusable="false"
android:visibility="visible"
app:iconifiedByDefault="false"
app:queryHint="Search Distributors..." />
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/search" />
<Button
android:id="@+id/btnGet"
android:visibility="visible"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_alignParentBottom="true"
android:text="get" />
</android.support.constraint.ConstraintLayout>
add a comment |
items.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/llMain"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/tvName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAlignment="center"
android:textSize="16sp"
android:text="fdfsfsdfsd"
android:layout_margin="5dp"/>
<Button
android:id="@+id/btnAdd"
android:layout_width="wrap_content"
android:layout_below="@+id/tvName"
android:layout_height="wrap_content"
android:text="Add Items"/>
<Button
android:layout_below="@+id/tvName"
android:id="@+id/btnMinus"
android:layout_alignParentEnd="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Add Items"/>
</RelativeLayout>
activity_main.xml
<android.support.v7.widget.SearchView
android:id="@+id/search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimaryDark"
android:focusable="false"
android:visibility="visible"
app:iconifiedByDefault="false"
app:queryHint="Search Distributors..." />
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/search" />
<Button
android:id="@+id/btnGet"
android:visibility="visible"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_alignParentBottom="true"
android:text="get" />
</android.support.constraint.ConstraintLayout>
items.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/llMain"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/tvName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAlignment="center"
android:textSize="16sp"
android:text="fdfsfsdfsd"
android:layout_margin="5dp"/>
<Button
android:id="@+id/btnAdd"
android:layout_width="wrap_content"
android:layout_below="@+id/tvName"
android:layout_height="wrap_content"
android:text="Add Items"/>
<Button
android:layout_below="@+id/tvName"
android:id="@+id/btnMinus"
android:layout_alignParentEnd="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Add Items"/>
</RelativeLayout>
activity_main.xml
<android.support.v7.widget.SearchView
android:id="@+id/search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimaryDark"
android:focusable="false"
android:visibility="visible"
app:iconifiedByDefault="false"
app:queryHint="Search Distributors..." />
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/search" />
<Button
android:id="@+id/btnGet"
android:visibility="visible"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_alignParentBottom="true"
android:text="get" />
</android.support.constraint.ConstraintLayout>
answered Jan 3 at 6:58


rajesh devarajesh deva
356
356
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54017123%2fin-android-application-recyclerview-view-show-only-half-of-the-phone-with%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
So you are saying the recyclerView is occupying half of the phone's screen width?
– Imtiaz Abir
Jan 3 at 6:23
Use this
View view=layoutInflater.inflate(R.layout.recyclerview_items,viewGroup,false);
instead of thisView view = layoutInflater.inflate(R.layout.recyclerview_items, null);
– Nilesh Rathod
Jan 3 at 6:37
THANKS for your replay. i was changed all layouts in relative layout. i solve my problem. but i cannot achieve in constraint layout.
– rajesh deva
Jan 3 at 6:54