Multiple RecyclerViews in ScrollView not Scrolling all the Way - android

I have three horizontal scrolling recycler views that are too large vertically for the app screen. To solve this, I nested them inside a NestedScrollView however the vertical scroll doesn't go all the way to the bottom of the last recycler view.
This is as far as the view will scroll:
Here's my config:
Container View:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<include
android:id="#+id/recyclerTop"
android:layout_width="match_parent"
android:layout_height="wrap_content"
layout="#layout/recycler_with_filters"/>
<include
android:id="#+id/recyclerMiddle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
layout="#layout/recycler_with_filters"/>
<include
android:id="#+id/recyclerBottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
layout="#layout/recycler_with_filters"/>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>
Included layout:
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:text="Test!"
android:textColor="#color/colorPrimaryDark"
android:textSize="24sp"
app:fontFamily="#font/didot"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:id="#+id/filters"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
android:orientation="horizontal"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="#id/header">
<Button
android:id="#+id/filter1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#drawable/btn_filter_inactive"
android:textColor="#color/colorPrimaryDark"
android:text="filter1" />
<Button
android:id="#+id/filter2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#drawable/btn_filter_inactive"
android:textColor="#color/colorPrimaryDark"
android:text="filter2" />
<Button
android:id="#+id/filter3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#drawable/btn_filter_inactive"
android:textColor="#color/colorPrimaryDark"
android:text="filter3" />
<Button
android:id="#+id/filter4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#drawable/btn_filter_inactive"
android:textColor="#color/colorPrimaryDark"
android:text="filter4" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
android:scrollbars="vertical"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="#id/filters" />
</androidx.constraintlayout.widget.ConstraintLayout>
Controller:
public class TestRecyclerFragment extends Fragment {
public static TestRecyclerFragment newInstance() {
return new TestRecyclerFragment();
}
private RecyclerView mRecyclerViewTop;
private RecyclerView mRecyclerViewMiddle;
private RecyclerView mRecyclerViewBottom;
private RecyclerView.Adapter mAdapterTop;
private RecyclerView.Adapter mAdapterMiddle;
private RecyclerView.Adapter mAdapterBottom;
private Business[] mBusinesses = {new Business("The Tavern", 0), new Business("The Tavern1", 0), new Business("The Tavern2", 0), new Business("The Tavern3", 0), new Business("The Tavern4", 0), new Business("The Tavern5", 0), new Business("The Tavern6", 1), new Business("The Tavern7", 1), new Business("The Tavern8", 1), new Business("The Tavern9", 1), new Business("The Tavern10", 1), new Business("The Tavern11", 1)};
#Override
public void onCreate(#Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_test_recycler, container, false);
View recycleWithFilterTop = v.findViewById(R.id.recyclerTop);
mRecyclerViewTop = recycleWithFilterTop.findViewById(R.id.recycler_view);
View recycleWithFilterMiddle = v.findViewById(R.id.recyclerMiddle);
mRecyclerViewMiddle = recycleWithFilterMiddle.findViewById(R.id.recycler_view);
View recycleWithFilterBottom = v.findViewById(R.id.recyclerBottom);
mRecyclerViewBottom = recycleWithFilterBottom.findViewById(R.id.recycler_view);
mRecyclerViewTop.setHasFixedSize(true);
mRecyclerViewMiddle.setHasFixedSize(true);
mRecyclerViewBottom.setHasFixedSize(true);
RecyclerView.LayoutManager layoutManagerTop = new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false);
mRecyclerViewTop.setLayoutManager(layoutManagerTop);
RecyclerView.LayoutManager layoutManagerMiddle = new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false);
mRecyclerViewMiddle.setLayoutManager(layoutManagerMiddle);
RecyclerView.LayoutManager layoutManagerBottom = new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false);
mRecyclerViewBottom.setLayoutManager(layoutManagerBottom);
mAdapterTop = new TestRecyclerFragment.TestAdapter(mBusinesses);
mRecyclerViewTop.setAdapter(mAdapterTop);
mAdapterMiddle = new TestRecyclerFragment.TestAdapter(mBusinesses);
mRecyclerViewMiddle.setAdapter(mAdapterMiddle);
mAdapterBottom = new TestRecyclerFragment.TestAdapter(mBusinesses);
mRecyclerViewBottom.setAdapter(mAdapterBottom);
return v;
}
public class TestAdapter extends RecyclerView.Adapter<TestAdapter.MyViewHolder> {
private Business[] businesses;
public class MyViewHolder extends RecyclerView.ViewHolder {
private TextView mBusinessName;
public MyViewHolder(View v) {
super(v);
mBusinessName = itemView.findViewById(R.id.businessName);
}
}
public TestAdapter(Business[] myDataset) {
mBusinesses = myDataset;
}
#Override
public TestAdapter.MyViewHolder onCreateViewHolder(ViewGroup parent,
int viewType) {
View v = LayoutInflater.from(parent.getContext())
.inflate(R.layout.view_holder_businesses, parent, false);
MyViewHolder vh = new MyViewHolder(v);
return vh;
}
#Override
public void onBindViewHolder(MyViewHolder holder, int position) {
holder.mBusinessName.setText(mBusinesses[position].getName());
}
// Return the size of your dataset (invoked by the layout manager)
#Override
public int getItemCount() {
return mBusinesses.length;
}
#Override
public int getItemViewType(int position) {
return mBusinesses[position].getViewType();
}
}
}
*Edit: I think the issue has to do with the scroll not knowing how large the view is going to be at the time it draws the view. I've tried hard-coding the heights in the include like this:
<include
android:id="#+id/recyclerTop"
android:layout_width="match_parent"
android:layout_height="400dp"
layout="#layout/recycler_with_filters"/>
However that messes up the view.
*Edit2: I've tried many of the solutions advocated in other questions on this topic including setting setting nestedScrollingEnabling to false. These solutions don't work in my instance. I'm not sure if it's a difference in my configuration or that I'm using a newer version of the NestedScrollView api.

Adding static height is not a proper solution considering different screen resolutions in the market. If you want to have multiple Recyclerviews scrolls as a whole inside NestedScrollView you should consider adding android:nestedScrollingEnabled="false" to Recyclerview:
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="#dimen/margin_activity_horizontal">
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layoutManager="LinearLayoutManager"
android:nestedScrollingEnabled="false"/>
<android.support.v7.widget.RecyclerView
android:layout_below="#+id/recycler_view_departments"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layoutManager="LinearLayoutManager"
android:nestedScrollingEnabled="false"/>
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>

I've tested your code, it's working perfectly my side, Just I've added below 3 lines of code in TestRecyclerFragment onCreateView method
mRecyclerViewTop.setNestedScrollingEnabled(false);
mRecyclerViewMiddle.setNestedScrollingEnabled(false);
mRecyclerViewBottom.setNestedScrollingEnabled(false);
You can see working demo https://www.dropbox.com/s/zmfmcdjw58cto4q/device-2019-09-05-115921.mp4?dl=0

I was able to get the scroll view to scroll to the bottom by adding a dynamic height to the layout params of my bottom recycler view:
RecyclerView.LayoutManager layoutManagerBottom = new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false);
mRecyclerViewBottom.setLayoutManager(layoutManagerBottom);
final float scale = getContext().getResources().getDisplayMetrics().density;
int pixels = (int) (550 * scale + 0.5f);
mRecyclerViewBottom.getLayoutParams().height = pixels;

Related

Android: TextView Alignment in RecyclerView [duplicate]

I have designed a layout with map fragment and recyclerView.
Each recyclerView item is cardview (I have specified give the xml layout).
The problem is RecyclerView item doesn't fill screen width.
img here
I tried to change layout_width to fill_parent, match_parent ... but it can't help
Here is the layout for each item
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:id="#+id/cardView">
<LinearLayout
android:id="#+id/locationItemView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="120px"
android:layout_height="120px"
android:id="#+id/imgIcon"
android:background="#drawable/image_bg"
android:layout_margin="5dp"
android:scaleType="fitCenter"
android:adjustViewBounds="true" />
<LinearLayout
android:id="#+id/layoutInfo"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<TextView
android:id="#+id/txtName"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Location Name"
android:textColor="#d5c645"
android:textStyle="bold"
android:textSize="20dp"
android:padding="3dp" />
<TextView
android:id="#+id/txtAddress"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Location Address"
android:textSize="16dp"
android:padding="3dp" />
<TextView
android:id="#+id/txtDistance"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:text="Location Distance"
android:textSize="14dp"
android:textStyle="italic"
android:padding="2dp"
android:textAlignment="viewEnd" />
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
and the main_layout
<android.support.v4.widget.DrawerLayout
android:id="#+id/drawer_layout"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:map="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent"
android:layout_height="0px" android:id="#+id/map" tools:context=".Main"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_weight=".6"/>
<android.support.v7.widget.RecyclerView
android:id="#+id/locationList"
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight=".4"
android:divider="#FEFFCC"
android:dividerHeight="1dp" />
</LinearLayout>
<ListView
android:id="#+id/navdrawer"
android:layout_width="250px"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="?attr/colorPrimaryDark"
android:choiceMode="singleChoice"
android:divider="#android:color/white"
android:dividerHeight="1dp"
android:drawSelectorOnTop="false"/>
</android.support.v4.widget.DrawerLayout>
Hope anyone can help me. I am stuck with it for 3 days.
Thank you.
====================================
Edit on 19/11/15
I don't thing the problem is my itemView layout because when I change it to GridLayout it still doesn't fill the width.
Here is my CustomAdapter for RecyclerView
public class LocationDetailsAdapter extends RecyclerView.Adapter<LocationDetailsViewHolder> {
Context _context;
ArrayList<LocationDetails> _data;
public LocationDetailsAdapter(Context _context, ArrayList<LocationDetails> _object) {
this._context = _context;
_data = _object;
}
#Override
public LocationDetailsViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
View _v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.list_location,null );
LocationDetailsViewHolder _viewHolder = new LocationDetailsViewHolder(_v);
return _viewHolder;
}
#Override
public void onBindViewHolder(LocationDetailsViewHolder locationDetailsViewHolder, int i) {
LocationDetails _location = _data.get(i);
locationDetailsViewHolder._imgType.setImageResource(R.drawable.repair_img);
locationDetailsViewHolder._locationName.setText(_location.get_locationName());
locationDetailsViewHolder._locationAddress.setText(_location.get_locationAddress() + ", " + _location.get_district() + ", " + _location.get_province());
locationDetailsViewHolder._distance.setText(String.valueOf(_location.get_distance()) + " km");
locationDetailsViewHolder._locationName.setOnClickListener(clickListener);
locationDetailsViewHolder._imgType.setOnClickListener(clickListener);
locationDetailsViewHolder._locationAddress.setOnClickListener(clickListener);
locationDetailsViewHolder._locationName.setTag(locationDetailsViewHolder);
locationDetailsViewHolder._imgType.setTag(locationDetailsViewHolder);
locationDetailsViewHolder._locationAddress.setTag(locationDetailsViewHolder);
}
#Override
public int getItemCount() {
return (null != _data ? _data.size() : 0);
}
View.OnClickListener clickListener = new View.OnClickListener() {
#Override
public void onClick(View v) {
LocationDetailsViewHolder _holder = (LocationDetailsViewHolder)v.getTag();
int _pos = _holder.getPosition();
int _id = _data.get(_pos).get_id();
Intent _intent = new Intent(CommonFields._context, ItemView.class);
_intent.putExtra("LocationID",_id);
_intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
CommonFields._context.startActivity(_intent);
}
};
}
and here I get RecylerView in main
_locationView = (RecyclerView)findViewById(R.id.locationList);
_locationView.setLayoutManager(new LinearLayoutManager(this));
_adapter = new LocationDetailsAdapter(Main.this, CommonFields._locationData);
_locationView.setAdapter(_adapter);
When inflating a View from a LayoutInflater, you need to pass a parent parameter in order for layout_* attributes to be used. That's because these attributes need to create the correct LayoutParams class. That means that you can't use inflate(R.layout.*, null), but must instead pass a ViewGroup for the second parameter. In most cases, you also want to use the three-parameter version of the method and pass false as the third parameter. If this is omitted or true then the View is immediately added to the parent, which causes problems in places like onCreateViewHolder() because the framework is designed to perform this operation later instead. For more details, see this answer.
In your case, you have the line
View _v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.list_location,null );
You should change it to
View _v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.list_location, viewGroup, false );
You should create View like this
#Override
public CardViewDataAdapter.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
// create a new view
View itemLayoutView = LayoutInflater.from(viewGroup.getContext()).inflate(
R.layout.card_view, viewGroup, false);
// create ViewHolder
ViewHolder viewHolder = new ViewHolder(itemLayoutView);
return viewHolder;
}
Maybe my answer has a different approach, but it works to occupy the entire width of the screen and not break the elements when passing through the recycling view.
Adapter adapterBalanceInquiry = new Adapter(getActivity(), list);
recyclerView.setHasFixedSize(true);
recyclerView.setNestedScrollingEnabled(false);
recyclerView.setAdapter(adapterBalanceInquiry);
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity(), RecyclerView.HORIZONTAL, false));
recyclerView.post(new Runnable() {
#Override
public void run() {
try {
int dx = (recyclerView.getWidth() - recyclerView.getChildAt(0).getWidth());
recyclerView.scrollBy(-dx, 0);
LinearSnapHelper snapHelper = new LinearSnapHelper();
recyclerView.setOnFlingListener(null);
snapHelper.attachToRecyclerView(recyclerView);
}catch (Exception e){
e.printStackTrace();
}
}
});

Horizontal recyclerview inside fragment not scrolling

I want to add horizontal recyclerview at the bottom of fragment. I followed the tutorial and successfully implemented horizontal recyclerview and cardview but after trying all possible answers,horizontal scrolling is not working.
Here is my code :-
XML :-
<RelativeLayout tools:context="com.AlfaCab.Menuactivtiy"
android:paddingTop="#dimen/activity_vertical_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingBottom="#dimen/activity_vertical_margin"
android:layout_marginTop="56dp"
android:id="#+id/Mainlayout"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:background="#color/BgColor"
xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_alignParentBottom="true"
android:background="#drawable/offer_white_box">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Offers"
android:gravity="center"
android:textSize="18sp"
android:textColor="#color/BlackTextColor"
android:textStyle="bold"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="5dp" />
<android.support.v7.widget.RecyclerView
android:id="#+id/recyclerView_offer"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layoutManager="android.support.v7.widget.LinearLayoutManager"
android:scrollbars="none"/>
<!-- android:orientation="horizontal"
android:scrollbars="horizontal"
app:layoutManager="android.support.v7.widget.LinearLayoutManager"
/> -->
</LinearLayout>
</RelativeLayout>
Here is my offer_cardview.xml / custom layout for recyclerview :-
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="wrap_content"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp">
<!-- <!–Offer Start–>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="#drawable/offer_white_box">
-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<!--Offer Coupon-->
<LinearLayout
android:layout_width="140dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="#drawable/round_box"
>
<LinearLayout
android:id="#+id/ll_offer_bg"
android:layout_width="match_parent"
android:layout_height="60dp"
android:orientation="horizontal"
android:background="#drawable/offer_red_box"
android:layout_marginBottom="3dp">
<TextView
android:id="#+id/tv_offer_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Get 30% Cashback"
android:textSize="12sp"
android:textColor="#color/WhiteTextColor"
android:textStyle="bold"
android:layout_gravity="center_vertical"
android:gravity="center"/>
</LinearLayout>
<TextView
android:id="#+id/tv_offer_disc"
android:layout_width="match_parent"
android:layout_height="80dp"
android:text="upto Rs. 300 cashback on Outstation"
android:textSize="10sp"
android:textColor="#color/BlackTextColor"
android:layout_marginBottom="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"/>
</LinearLayout>
<!--Offer Coupon Ends-->
</LinearLayout>
<!--</LinearLayout>-->
<!--Offer Ends-->
</android.support.v7.widget.CardView>
</LinearLayout>
HomeFragment.java :-
//a list to store all the products
List<Offer_Data> offerList;
//the recyclerview
RecyclerView recyclerView;
String appOfferId,appOfferTitle,appOfferDes,status;
In onCreate :-
//getting the recyclerview from xml
recyclerView = (RecyclerView) rootView.findViewById(R.id.recyclerView_offer);
After successfully adding data to offerList :-
//creating recyclerview adapter
Offer_Adapter adapter = new Offer_Adapter(getActivity(), offerList);
//adapter.notifyDataSetChanged();
recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
recyclerView.setAdapter(adapter);
adapter.notifyDataSetChanged();// Notify the adapter
Offer_Adapter.java :- (Recyclervire adapter)
public class Offer_Adapter extends RecyclerView.Adapter<Offer_Adapter.ProductViewHolder> {
int[] myImageList;
//this context we will use to inflate the layout
private Context mCtx;
//we are storing all the products in a list
private List<Offer_Data> offerList;
//getting the context and product list with constructor
public Offer_Adapter(Context mCtx, List<Offer_Data> offerList) {
this.mCtx = mCtx;
this.offerList = offerList;
this.myImageList = new int[]{R.drawable.offer_red_box, R.drawable.offer_megento_box, R.drawable.offer_yellow_box};
}
#Override
public ProductViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
//inflating and returning our view holder
LayoutInflater inflater = LayoutInflater.from(mCtx);
View view = inflater.inflate(R.layout.offer_cardview, null);
return new ProductViewHolder(view);
}
#Override
public void onBindViewHolder(ProductViewHolder holder, int position) {
//getting the product of the specified position
Offer_Data product = offerList.get(position);
//binding the data with the viewholder views
holder.tv_offer_title.setText(product.getOffer_title());
holder.tv_offer_disc.setText(product.getOffer_disc());
int random_box = getRandom(myImageList);
holder.ll_offer_bg.setBackgroundResource(random_box);
}
public static int getRandom(int[] array) {
int rnd = new Random().nextInt(array.length);
return array[rnd];
}
#Override
public int getItemCount() {
return offerList.size();
}
class ProductViewHolder extends RecyclerView.ViewHolder {
TextView tv_offer_title, tv_offer_disc;
LinearLayout ll_offer_bg;
public ProductViewHolder(View itemView) {
super(itemView);
tv_offer_title = (TextView) itemView.findViewById(R.id.tv_offer_title);
tv_offer_disc = (TextView) itemView.findViewById(R.id.tv_offer_disc);
ll_offer_bg = (LinearLayout)itemView.findViewById(R.id.ll_offer_bg);
}
}
}
Please, help me to make it scroll horizontally.
LinearLayoutManager linearLayoutManager
= new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false);
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
recyclerView.setLayoutManager(linearLayoutManager);
Found the Problem
Change this line
recyclerView.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
to
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false));
Problem is that , you are passing wrong context to recycler view manager
Should use getActivity() not getContext()
ALso no need to add this line in xml
app:layoutManager="android.support.v7.widget.LinearLayoutManager"

Recyclerview with LinearLayout cannot scroll

I will fill view by adapter and when iam fill data to RV then can not scroll.
This is my RC:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.SwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/trip_ticket_refresh"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="#+id/trip_ticket_recycler"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</android.support.v4.widget.SwipeRefreshLayout>
RC is fill by this view:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
style="#style/TripMyTicketScrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:orientation="vertical">
<Button
android:id="#+id/my_ticket_port_and_directions"
android:layout_width="match_parent"
android:layout_height="#dimen/grid_14"
android:layout_marginEnd="#dimen/grid_2"
android:layout_marginLeft="#dimen/grid_2"
android:layout_marginRight="#dimen/grid_2"
android:layout_marginStart="#dimen/grid_2"
android:layout_marginTop="#dimen/grid_1"
android:height="#dimen/grid_5"
android:background="#color/bg_on_board_button"
android:drawableEnd="#drawable/ic_keyboard_arrow_right"
android:drawableLeft="#drawable/ic_rudder_black_32dp"
android:drawablePadding="6dp"
android:drawableRight="#drawable/ic_keyboard_arrow_right"
android:drawableStart="#drawable/ic_rudder_black_32dp"
android:gravity="center|start"
android:padding="#dimen/grid_2"
android:text="#string/my_ticket_port_and_direction"
android:textColor="#color/text_color_my_trip_button"
android:textStyle="bold" />
<include layout="#layout/view_my_trip_time_schedule" />
<include layout="#layout/view_my_trip_passengers_and_cabins" />
<include layout="#layout/view_my_trip_booking_number" />
</LinearLayout>
There are some linear layouts with buttons and textview in <include layout=...
And when view across the screen size then normally start scroll but in this case not.
Adapter is empty for now because i have to solve this problem a them i will continue.
Can you help me?
Thank you.
Update
This is RC init in Fragment
private void initRecyclerView(){
mAdapter = new MyTicketAdapter(getContext());
RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getActivity());
mRecyclerRv.setLayoutManager(mLayoutManager);
mRecyclerRv.setAdapter(mAdapter);
}
Adapter does not fill any data for now. Here is adapter:
public class MyTicketAdapter extends RecyclerView.Adapter<MyTicketAdapter.MyViewHolder> {
private static final int BARCODE_IMAGE_WIDTH = 150;
private static final int BARCODE_IMAGE_HEIGHT = 40;
private Departure mDeparture;
private final Context mContext;
public class MyViewHolder extends RecyclerView.ViewHolder {
//
// #BindView(R.id.my_ticket_booking_number_barcode_ticket)
// ImageView mBarcodeImageView;
//
// #BindView(R.id.my_ticket_booking_number_barcode_booking_number)
// TextView mBookingNumberBelowBarcode;
//
public MyViewHolder(View view) {
super(view);
ButterKnife.bind(this, view);
}
}
/**
* Creates a new instance of this class.
*
* #param context need values from resource.
*/
public MyTicketAdapter(Context context) {
mContext = context;
}
#Override
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View itemView = LayoutInflater.from(parent.getContext())
.inflate(R.layout.list_item_trip_ticket, parent, false);
return new MyViewHolder(itemView);
}
#Override
public void onBindViewHolder(MyTicketAdapter.MyViewHolder holder, int position) {
if (mDeparture == null) {
return;
}
TravelMateLogs.MY_TICKET_ADAPTER.i("--------Departure: " + mDeparture.toString());
// generateBarcode(holder);
}
#Override
public int getItemCount() {
// There is only one item.
if(mDeparture == null){
return 0;
}else {
return 1;
}
}
/**
* Sets the data to be displayed in the list.
*
* #param departure The departure to be displayed in the view. Null will clear the list.
*/
void setData(#Nullable Departure departure) {
mDeparture = departure;
notifyDataSetChanged();
}
}
<android.support.v7.widget.RecyclerView
android:id="#+id/trip_ticket_recycler"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
If is wrap, recyclerview is not visible. Also please post recyclerview initialisation.
Solution:
I had to wrap all part to linearlayout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
style="#style/TripMyTicketScrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/bg_trip_tab_view"
android:orientation="vertical"
android:paddingBottom="#dimen/grid_14">
<include layout="#layout/view_my_trip_time_schedule" />
<include layout="#layout/view_my_trip_passengers_and_cabins" />
<include layout="#layout/view_my_trip_booking_number" />
</LinearLayout>
</LinearLayout>
Now it is work ...

RecyclerView items don't fill width

I have designed a layout with map fragment and recyclerView.
Each recyclerView item is cardview (I have specified give the xml layout).
The problem is RecyclerView item doesn't fill screen width.
img here
I tried to change layout_width to fill_parent, match_parent ... but it can't help
Here is the layout for each item
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:id="#+id/cardView">
<LinearLayout
android:id="#+id/locationItemView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="120px"
android:layout_height="120px"
android:id="#+id/imgIcon"
android:background="#drawable/image_bg"
android:layout_margin="5dp"
android:scaleType="fitCenter"
android:adjustViewBounds="true" />
<LinearLayout
android:id="#+id/layoutInfo"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<TextView
android:id="#+id/txtName"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Location Name"
android:textColor="#d5c645"
android:textStyle="bold"
android:textSize="20dp"
android:padding="3dp" />
<TextView
android:id="#+id/txtAddress"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Location Address"
android:textSize="16dp"
android:padding="3dp" />
<TextView
android:id="#+id/txtDistance"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:text="Location Distance"
android:textSize="14dp"
android:textStyle="italic"
android:padding="2dp"
android:textAlignment="viewEnd" />
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
and the main_layout
<android.support.v4.widget.DrawerLayout
android:id="#+id/drawer_layout"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:map="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent"
android:layout_height="0px" android:id="#+id/map" tools:context=".Main"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_weight=".6"/>
<android.support.v7.widget.RecyclerView
android:id="#+id/locationList"
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight=".4"
android:divider="#FEFFCC"
android:dividerHeight="1dp" />
</LinearLayout>
<ListView
android:id="#+id/navdrawer"
android:layout_width="250px"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="?attr/colorPrimaryDark"
android:choiceMode="singleChoice"
android:divider="#android:color/white"
android:dividerHeight="1dp"
android:drawSelectorOnTop="false"/>
</android.support.v4.widget.DrawerLayout>
Hope anyone can help me. I am stuck with it for 3 days.
Thank you.
====================================
Edit on 19/11/15
I don't thing the problem is my itemView layout because when I change it to GridLayout it still doesn't fill the width.
Here is my CustomAdapter for RecyclerView
public class LocationDetailsAdapter extends RecyclerView.Adapter<LocationDetailsViewHolder> {
Context _context;
ArrayList<LocationDetails> _data;
public LocationDetailsAdapter(Context _context, ArrayList<LocationDetails> _object) {
this._context = _context;
_data = _object;
}
#Override
public LocationDetailsViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
View _v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.list_location,null );
LocationDetailsViewHolder _viewHolder = new LocationDetailsViewHolder(_v);
return _viewHolder;
}
#Override
public void onBindViewHolder(LocationDetailsViewHolder locationDetailsViewHolder, int i) {
LocationDetails _location = _data.get(i);
locationDetailsViewHolder._imgType.setImageResource(R.drawable.repair_img);
locationDetailsViewHolder._locationName.setText(_location.get_locationName());
locationDetailsViewHolder._locationAddress.setText(_location.get_locationAddress() + ", " + _location.get_district() + ", " + _location.get_province());
locationDetailsViewHolder._distance.setText(String.valueOf(_location.get_distance()) + " km");
locationDetailsViewHolder._locationName.setOnClickListener(clickListener);
locationDetailsViewHolder._imgType.setOnClickListener(clickListener);
locationDetailsViewHolder._locationAddress.setOnClickListener(clickListener);
locationDetailsViewHolder._locationName.setTag(locationDetailsViewHolder);
locationDetailsViewHolder._imgType.setTag(locationDetailsViewHolder);
locationDetailsViewHolder._locationAddress.setTag(locationDetailsViewHolder);
}
#Override
public int getItemCount() {
return (null != _data ? _data.size() : 0);
}
View.OnClickListener clickListener = new View.OnClickListener() {
#Override
public void onClick(View v) {
LocationDetailsViewHolder _holder = (LocationDetailsViewHolder)v.getTag();
int _pos = _holder.getPosition();
int _id = _data.get(_pos).get_id();
Intent _intent = new Intent(CommonFields._context, ItemView.class);
_intent.putExtra("LocationID",_id);
_intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
CommonFields._context.startActivity(_intent);
}
};
}
and here I get RecylerView in main
_locationView = (RecyclerView)findViewById(R.id.locationList);
_locationView.setLayoutManager(new LinearLayoutManager(this));
_adapter = new LocationDetailsAdapter(Main.this, CommonFields._locationData);
_locationView.setAdapter(_adapter);
When inflating a View from a LayoutInflater, you need to pass a parent parameter in order for layout_* attributes to be used. That's because these attributes need to create the correct LayoutParams class. That means that you can't use inflate(R.layout.*, null), but must instead pass a ViewGroup for the second parameter. In most cases, you also want to use the three-parameter version of the method and pass false as the third parameter. If this is omitted or true then the View is immediately added to the parent, which causes problems in places like onCreateViewHolder() because the framework is designed to perform this operation later instead. For more details, see this answer.
In your case, you have the line
View _v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.list_location,null );
You should change it to
View _v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.list_location, viewGroup, false );
You should create View like this
#Override
public CardViewDataAdapter.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
// create a new view
View itemLayoutView = LayoutInflater.from(viewGroup.getContext()).inflate(
R.layout.card_view, viewGroup, false);
// create ViewHolder
ViewHolder viewHolder = new ViewHolder(itemLayoutView);
return viewHolder;
}
Maybe my answer has a different approach, but it works to occupy the entire width of the screen and not break the elements when passing through the recycling view.
Adapter adapterBalanceInquiry = new Adapter(getActivity(), list);
recyclerView.setHasFixedSize(true);
recyclerView.setNestedScrollingEnabled(false);
recyclerView.setAdapter(adapterBalanceInquiry);
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity(), RecyclerView.HORIZONTAL, false));
recyclerView.post(new Runnable() {
#Override
public void run() {
try {
int dx = (recyclerView.getWidth() - recyclerView.getChildAt(0).getWidth());
recyclerView.scrollBy(-dx, 0);
LinearSnapHelper snapHelper = new LinearSnapHelper();
recyclerView.setOnFlingListener(null);
snapHelper.attachToRecyclerView(recyclerView);
}catch (Exception e){
e.printStackTrace();
}
}
});

CardView not showing content eclipse

I am using android.support.v7.widget.CardView to show ImageView with two TextView's in RecyclerView but card view not showing the content(showing only blank white cards) when the screen orientation is vertical, on the other hand it is showing content when orientation is landscape.
When I run the same project from AndroidStudio there is no problem everything works fine.
I don't understand what is problem out there, is there problem with eclipse?
Please see the code below,
PostListFragment
public class PostListFragment extends Fragment implements AppConfig {
private ArrayList<Post> mPostArrayList;
private PostRecyclerAdapter mPostRecyclerAdapter;
private RecyclerView mRecyclerView;
//other declarations
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
//removed
}
private void init() {
// Set up RecyclerView
mRecyclerView = (RecyclerView) mRootView
.findViewById(R.id.mPostListRecyclerView);
// Setup layout manager for mPostArrayList and column count
final LinearLayoutManager mLayoutManager = new LinearLayoutManager(
getActivity());
// Control orientation of the mPostArrayList
mLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
mLayoutManager.scrollToPosition(0);
// Attach layout manager
mRecyclerView.setLayoutManager(mLayoutManager);
// Listen to the item touching
mRecyclerView.addOnItemTouchListener(new RecyclerItemClickListener(
getActivity(),
new RecyclerItemClickListener.OnItemClickListener() {
#Override
public void onItemClick(View itemView, int position) {
//some action
}
}));
mPostArrayList = new ArrayList<>();
// Bind adapter to recycler
mPostRecyclerAdapter = new PostRecyclerAdapter(
getActivity(), mPostArrayList);
mRecyclerView.setAdapter(mPostRecyclerAdapter);
}
private void getPosts() {
// Execute async task
new AsyncPosts().execute(mPostURL);
}
public class AsyncPosts extends AsyncTask<Object, String, JSONObject> {
//no problem with this
}
}
Layout used for PostListFragment
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/mParentLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<FrameLayout
android:id="#+id/mPostListContainer"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<android.support.v4.widget.SwipeRefreshLayout
android:id="#+id/mPostListSwipeRefreshLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<android.support.v7.widget.RecyclerView
android:id="#+id/mPostListRecyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.v4.widget.SwipeRefreshLayout>
</FrameLayout>
<!-- removed -->
</LinearLayout>
Here is adapter to set the values,
PostRecyclerAdapter
public class PostRecyclerAdapter extends
RecyclerView.Adapter<PostRecyclerAdapter.SimpleItemViewHolder> {
private Context mContext;
private List<Post> post;
// Provide a suitable constructor (depends on the kind of data store)
public PostRecyclerAdapter(Context context, List<Post> items) {
this.mContext = context;
this.post = items;
}
// Return the size of your data set (invoked by the layout manager)
#Override
public int getItemCount() {
return this.post.size();
}
// Create new items (invoked by the layout manager)
// Usually involves inflating a layout from XML and returning the holder
#Override
public SimpleItemViewHolder onCreateViewHolder(ViewGroup viewGroup,
int viewType) {
View itemView = LayoutInflater.from(viewGroup.getContext()).inflate(
R.layout.post_list_item, viewGroup, false);
return new SimpleItemViewHolder(itemView);
}
// Replace the contents of a view (invoked by the layout manager)
// Involves populating data into the item through holder
#Override
public void onBindViewHolder(SimpleItemViewHolder viewHolder, int position) {
Glide.with(mContext).load(post.get(position).IMG_URL)
.placeholder(R.drawable.ic_placeholder).crossFade(1000)
.centerCrop().into(viewHolder.mPostListSmallThumbnail);
viewHolder.mPostListSmallTitle.setText(post.get(position).POST_TITLE);
viewHolder.mPostListSmallContent
.setText(post.get(position).POST_CONTENT);
}
// Provide a reference to the views for each data item
// Provide access to all the views for a data item in a view holder
public final static class SimpleItemViewHolder extends
RecyclerView.ViewHolder {
ImageView mPostListSmallThumbnail;
TextView mPostListSmallTitle, mPostListSmallContent;
public SimpleItemViewHolder(View itemView) {
super(itemView);
mPostListSmallThumbnail = (ImageView) itemView
.findViewById(R.id.mPostListSmallThumbnail);
mPostListSmallTitle = (TextView) itemView
.findViewById(R.id.mPostListSmallTitle);
mPostListSmallContent = (TextView) itemView
.findViewById(R.id.mPostListSmallContent);
}
}
}
post_list_item
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/mPostListSmallCard"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:foreground="#drawable/card_background"
android:clickable="true"
app:cardCornerRadius="#dimen/blog_card_radius"
app:cardUseCompatPadding="true"
app:contentPadding="#dimen/blog_card_radius">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="#+id/mPostListSmallThumbnail"
android:layout_width="#dimen/blog_image_thumb_dim"
android:layout_height="#dimen/blog_image_thumb_dim"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:background="#drawable/ic_placeholder"
android:adjustViewBounds="true"
android:contentDescription="#string/image_thumbnail_placeholder" />
<TextView
android:id="#+id/mPostListSmallTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="#dimen/post_list_margin_left"
android:layout_marginStart="#dimen/post_list_margin_right"
android:layout_toEndOf="#+id/mPostListSmallThumbnail"
android:layout_toRightOf="#+id/mPostListSmallThumbnail"
android:ellipsize="end"
android:lines="2"
android:singleLine="false"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/mPostListSmallContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/mPostListSmallThumbnail"
android:layout_alignEnd="#+id/mPostListSmallTitle"
android:layout_alignLeft="#+id/mPostListSmallTitle"
android:layout_alignRight="#+id/mPostListSmallTitle"
android:layout_alignStart="#+id/mPostListSmallTitle"
android:layout_below="#+id/mPostListSmallTitle"
android:ellipsize="end"
android:lines="3"
android:textAppearance="?android:attr/textAppearanceSmall" />
</RelativeLayout>
</android.support.v7.widget.CardView>
Here is post_list_item for landscape layout
land/post_list_item
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/mPostListSmallCard"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="#dimen/blog_card_margin_landscape"
android:layout_marginLeft="#dimen/blog_card_margin_landscape"
app:cardCornerRadius="#dimen/blog_card_radius"
app:cardUseCompatPadding="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="#+id/mPostListSmallThumbnail"
android:layout_width="#dimen/blog_image_thumb_dim"
android:layout_height="#dimen/blog_image_thumb_dim"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:adjustViewBounds="true"
android:contentDescription="#string/image_thumbnail_placeholder" />
<TextView
android:id="#+id/mPostListSmallTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="#dimen/post_list_margin_left"
android:layout_marginStart="#dimen/post_list_margin_right"
android:layout_toEndOf="#+id/mPostListSmallThumbnail"
android:layout_toRightOf="#+id/mPostListSmallThumbnail"
android:ellipsize="end"
android:lines="2"
android:singleLine="false"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/mPostListSmallContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/mPostListSmallThumbnail"
android:layout_alignEnd="#+id/mPostListSmallTitle"
android:layout_alignLeft="#+id/mPostListSmallTitle"
android:layout_alignRight="#+id/mPostListSmallTitle"
android:layout_alignStart="#+id/mPostListSmallTitle"
android:layout_below="#+id/mPostListSmallTitle"
android:ellipsize="end"
android:lines="3"
android:textAppearance="?android:attr/textAppearanceSmall" />
</RelativeLayout>
</android.support.v7.widget.CardView>

Categories

Resources