1

How can I align text with the icon? It is working fine if I remove parent property but it is being used by some other activity so I cannot remove it. I think I might have messed up somewhere in layout xml file but couldn't find it out.

styles.xml

<style name="DarkToolbar" parent="Widget.AppCompat.Toolbar">
    <item name="android:background">@color/whateever</item>
    <item name="android:textColor">@android:color/white</item>
    <item name="android:textColorPrimary">@android:color/white</item>
    <item name="colorControlNormal">@android:color/white</item>
</style>

<style name="LightPopupMenu">
    <item name="android:background">@android:color/white</item>
    <item name="android:textColor">@android:color/black</item>
    <item name="overlapAnchor">false</item>
</style>

layout.xml

<androidx.coordinatorlayout.widget.CoordinatorLayout
    android:id="@+id/c_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/window_background_dark">

        <androidx.appcompat.widget.Toolbar
            android:id="@+id/move_pick_toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:theme="@style/DarkToolbar"
            app:popupTheme="@style/LightPopupMenu"
            android:elevation="4dp">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical">
                <TextView
                    android:id="@+id/toolbar_title"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:gravity="center"
                    android:text="@string/move_wf_pick_toolbar_title"
                    android:textSize="24sp" />
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textSize="20sp"
                    android:gravity="center"
                    tools:text="Token: 123" />
            </LinearLayout>
        </androidx.appcompat.widget.Toolbar>


        <FrameLayout />

     </LinearLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
        

Current behaviour:

enter image description here

is there a way to achieve this without removing parent attribute?

0 Answers0