Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working with androidx.appcompat.widget.Toolbar #1

Open
tmm1 opened this issue Oct 25, 2018 · 4 comments
Open

Not working with androidx.appcompat.widget.Toolbar #1

tmm1 opened this issue Oct 25, 2018 · 4 comments

Comments

@tmm1
Copy link

tmm1 commented Oct 25, 2018

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?

@masqueNada
Copy link

@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.

@soltesu29
Copy link

<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"

    />

1 similar comment
@soltesu29
Copy link

<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"

    />

@thecreativedg
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants