Toolbar-Center-Title icon indicating copy to clipboard operation
Toolbar-Center-Title copied to clipboard

Not working with androidx.appcompat.widget.Toolbar

Open tmm1 opened this issue 7 years ago • 4 comments

I tried to use this library as such:

    <androidx.appcompat.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_alignParentTop="true"
        android:background="@color/bar_tint"
        android:theme="@style/ToolbarTheme"
        app:popupTheme="@style/PopupTheme"
        bind:centerTitle="@{true}"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

but the text is not centered.

Does it work with androidx?

tmm1 avatar Oct 25 '18 22:10 tmm1

@tmm1 I copied this file from the library into my project /Toolbar-Center-Title/library/src/main/java/com/ravikoradiya/library/CenterTitle.kt changed following toolbar import to corresponding androidx one :

import android.support.v7.widget.Toolbar
import androidx.appcompat.widget.Toolbar 

and it worked like a charm with androidx :) PS: No need to add a gradle dependency this way.

masqueNada avatar Dec 02 '18 16:12 masqueNada

<androidx.appcompat.widget.Toolbar android:layout_height="?android:attr/actionBarSize" android:layout_width="match_parent" android:id="@+id/toolbar" android:layout_alignParentTop="true" android:background="@color/colorAccent"

    />

soltesu29 avatar Nov 08 '19 15:11 soltesu29

<androidx.appcompat.widget.Toolbar android:layout_height="?android:attr/actionBarSize" android:layout_width="match_parent" android:id="@+id/toolbar" android:layout_alignParentTop="true" android:background="@color/colorAccent"

    />

soltesu29 avatar Nov 08 '19 15:11 soltesu29

@masqueNada can you explain more how you did it? Where to put what?

thecreativedg avatar Apr 27 '20 14:04 thecreativedg