I have a toolbar and a navigation drawer below the toolbar (not on top). I like to fade in a textview in toolbar as user opens navigation drawer with swiping to right. I want the fade in/out effect related to how much drawer is opened and in which direction. For example, when opening, title textview in toolbar should fade in. When closing, title in toolbar should fade out. If user stops swiping when drawer is %50 opened, the textview's alpha should stop at %50 also. Any help would be appreciated.
You can use this answer and do something like this:
View myText = findViewById(R.id.toolbarText) // replace with your text id
mDrawerToggle = new ActionBarDrawerToggle(
this,
mDrawerLayout,
R.drawable.ic_drawer,
R.string.drawer_open,
R.string.drawer_close
) {
@Override
public void onDrawerSlide(View drawerView, float slideOffset) {
myText.setAlpha(slideOffset); //As easy as this line
}
};