我想在工具栏中显示两个文本视图小部件。其中一个文本视图充当标题,另一个充当子标题,应该放在工具栏小部件的最右边。
这是我为显示两个文本视图所做的xml代码,一个在左侧,另一个在右侧。
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/tool_bar_color"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:titleTextAppearance="@style/AppTheme.Toolbar.Title">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="start|center"
android:textSize="20sp"
android:textColor="@color/white"
android:layout_gravity="center"
android:textStyle="bold"
android:text="Hello"
android:singleLine="true"
android:id="@+id/toolbar_title" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="end|center"
android:textSize="15sp"
android:textColor="@color/white"
android:layout_gravity="center"
android:textStyle="bold"
android:text="India Hello"
android:singleLine="true"
android:id="@+id/toolbar_right_subtitle" />
</android.support.v7.widget.Toolbar>
在工具栏中放置两个文本视图小部件后,我没有获得所需的输出。如何实现显示两个文本视图小部件(一个在左侧,另一个在右侧)的理想输出?