android-actionbar

How to change hamburger icon in Android (NavigationDrawer)

若如初见. 提交于 2020-08-02 08:18:06
问题 Before write this thread I have try to implement the different solution that I found in stackoverflow, but nothing work properly. I'm developing an Android applucation that use the custom navigation drawer, I have to change the standard icon of actionbar (now is toolbar, right ?), and settings icon. This is my code: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id

Add custom view to the right of toolbar

血红的双手。 提交于 2020-08-01 05:34:48
问题 I am trying to achieve this(A timer in toolbar with red background): I am trying to add customView in toolbar . It always end's up being on extreme left just beside the back arrow. Like the text YP in image below is a custom Textview added to toolbar.. The code for toolbar : <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.Toolbar android:id="@+id/base_activity_toolbar" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android

Why does my app crash invoking “setupActionBarWithNavController(navController, appBarConfiguration)”

允我心安 提交于 2020-05-30 19:13:46
问题 I am getting an error message in the LogCat window of Android Studio; Process: com.riverstonetech.gositeuk, PID: 27370 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.riverstonetech.gositeuk/com.riverstonetech.gositeuk.CountriesActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void androidx.appcompat.app.ActionBar.setTitle(java.lang.CharSequence)' on a null object reference at android.app.ActivityThread.performLaunchActivity(ActivityThread