我想使用带有两个子视图的Android工具栏。 两个子视图具有相同的文本大小但字体不同。
以下代码段将两个孩子垂直居中,但按钮比TextView稍微高一些。
我的问题是:如何在真正的基线上对齐两个孩子?
谢谢。
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light">
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="18sp"
app:font="@{@string/font_1}" />
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:background="@null"
android:gravity="center_vertical|right"
android:textSize="18sp"
app:font="@{@string/font_2}" />
</android.support.v7.widget.Toolbar>