One-line font applying using Android-M data-binding doesn't work
Provided the above layout and setup, assuming following:
Inside your RecyclerView
adapter you have bound the view by one of these ways:
In onCreateViewHolder method of your adapter class
@Override public MyAdapter.MyHolder onCreateViewHolder(ViewGroup parent, int viewType) { ViewDataBinding binding = DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), R.layout.recycler_item, parent, false); return new MyHolder(binding.getRoot()); }
Or in its onBindViewHolder method
@Override public void onBindViewHolder(MyAdapter.MyHolder holder, int position) { DataBindingUtil.bind(holder.itemView); //... }
Following resource setup
Your assets folder should look similar to this:
Your string resource file should have full qualified name for font:
<string name="kenyan">kenyan_rg.ttf</string>