Comments (10)
hi i just want to ask how can i make view for each navigation item ?
thanks in advance. i'm new to android programming
from materialintroview.
How can I select certain menu item?
from materialintroview.
@OneManStudioDotSe I will add this to sample asap. But you can achieve by following snippet.
private View getDrawerView(Toolbar toolbar) {
for (int i = 0; i < toolbar.getChildCount(); i++) {
if (toolbar.getChildAt(i) instanceof ImageButton)
return toolbar.getChildAt(i);
}
return null;
}
Give toolbar as a parameter.
from materialintroview.
Toolbar has 2 ImageButton (mNavButtonView,mCollapseButtonView)
try with reflection
Field field = Toolbar.class.getDeclaredField("mNavButtonView");
field.setAccessible(true);
view = (ImageButton)field.get(toolbar);
from materialintroview.
i'm using this function to get humberger view of toolbar :
public static View getToolbarNavigationIcon(Toolbar toolbar){
boolean hadContentDescription = TextUtils.isEmpty(toolbar.getNavigationContentDescription());
String contentDescription = !hadContentDescription ? toolbar.getNavigationContentDescription().toString() : "navigationIcon";
toolbar.setNavigationContentDescription(contentDescription);
ArrayList<View> potentialViews = new ArrayList<>();
toolbar.findViewsWithText(potentialViews,contentDescription, View.FIND_VIEWS_WITH_CONTENT_DESCRIPTION);
View navIcon = null;
if(potentialViews.size() > 0){
navIcon = potentialViews.get(0);
}
if(hadContentDescription)
toolbar.setNavigationContentDescription(null);
return navIcon;
}
from materialintroview.
@Behzodbek just find view by menu item id, sample in activity :
View favoriteItemView = findViewById(R.id.fav);
my menu xml file :
<?xml version="1.0" encoding="utf-8"?>
<menu
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:title="Fav It!"
android:id="@+id/fav"
app:showAsAction="always" />
</menu>
from materialintroview.
@DJafari actually your code seems like doing same thing with mine. You get index 0 if list is not empty, I get first imagebutton on childlist.
from materialintroview.
@Behzodbek If your problem is not solved please create new issue. Because seems like this drawer issue is solved.
from materialintroview.
Is there any way to focus the ActionBarDrawerToggle at the new ActionBar?
from materialintroview.
just find view by menu item id, sample in activity :
It's not working for me. Can you explain more?
from materialintroview.
Related Issues (20)
- Overlay circle not focusing on FloatingActionButton (getbase floating action button library) HOT 2
- Multiple run of onClickListener body HOT 1
- Manipulate the location of dialogue/info text
- Please update the library
- How do I create a Sequence? HOT 2
- Build Gradle app failed to sync.
- OutOfMemoryError HOT 2
- Failed to resolve: com.github.iammert:MaterialIntroView:1.6.0 HOT 8
- ERROR: Failed to resolve: com.github.iammert:ExpandableLayout:1.3
- l
- Outdated sample code in README.md
- Select burger menu Icon HOT 1
- Show the intro each time whenever activity opens. HOT 1
- Kotlin-based, v2
- Crashing on Landscape Mode
- Action Bar Drawer Toggle HOT 1
- Can we change the icon?
- No skip button in Material Intro
- Full screen greyed out HOT 1
- Not getting the androidx version 2.0.0 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from materialintroview.