Please tell me the following, there are a lot of fragments and on the click of the text (the name of the project) in the toolbar 'e should show the main fragment. How to make this text clickable or where to dig at least?
|
1 answer
XML:
<android.support.v7.widget.Toolbar android:id="@+id/toolbar" ...> <TextView android:id="@+id/toolbar_title" ... /> </android.support.v7.widget.Toolbar> In class:
toolbar.findViewById(R.id.toolbar_title).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Log.d(TAG,"Clicked"); } }); PS Remove the main name and add it to TextView .
- Is that how they do it?) I mean the text which by default is set as the name of the project, is it not necessary to register it in the
TextView? - T. Kudaibergen - @ T.Kudaibergen Well, I don’t see any obstacles :) I gave the basis for the digging, I hope) But they’re doing something else too) - iFr0z
- Unfortunately, this is not the case, another text is created next to the main title in the tulbulb, but I need to get access to the main title - T. Kudaibergen
- @ T.Kudaibergen remove the main text and put the textview? - iFr0z
- That's how it is) I thought that there was a special method for this) Many thanks - T. Kudaibergen
|