Как изменить положение ActionOverflow в панели инструментов
В моем изображении выше, я с помощью панели инструментов в качестве моего действия бара. В этой панели у меня есть TextView, которые содержат имя президента и у меня есть tablayout, которые содержат 3 вкладки (item1, ст.2, ст.3)
когда я раздувать мое меню в onCreateOptionsMenu(Menu menu)
метод, мой ActionOverflow (в три белых точки) появляется ниже моего текстового комментария президента, и я хотел бы появиться в крайнем правом тексте президента. это влияет на мою ширину tablayout, потому что она не может соответствовать родительской (панели инструментов), которая заполняет ширину экрана.
Как я могу достичь своей цели?
моя активность XML
<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:id="@+id/mainActivityBar"
android:layout_alignParentTop="true"
android:background="@drawable/actionbar"
app:contentInsetLeft="0dp"
app:contentInsetStart="0dp"
app:contentInsetEnd="0dp"
app:contentInsetRight="0dp"
app:popupTheme="@style/Theme.AppCompat.Light.NoActionBar">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="President"
android:id="@+id/appname_1"
android:background="@android:color/transparent"
android:textColor="#ffffff"
android:layout_marginLeft="20dp" />
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
style="@style/myCustomTabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:layout_below="@+id/appname_1"
android:layout_alignParentEnd="true"
android:layout_alignParentStart="false"
android:layout_alignParentLeft="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="false"
android:fillViewport="true"
android:layout_alignLeft="@+id/appname_1"
app:tabGravity="fill"
app:tabMode="scrollable"/>
</RelativeLayout>
</android.support.v7.widget.Toolbar>
мои syles
<style name="mainActivityTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
<item name="android:textColorSecondary">@android:color/white</item>
<!--We will be using the toolbar so no need to show ActionBar-->
<item name="android:windowActionBar">false</item>
</style>
<style name="myCustomTabLayout" parent="Widget.Design.TabLayout">
<item name="tabIndicatorColor">?attr/colorAccent</item>
<item name="tabIndicatorHeight">2dp</item>
<item name="tabSelectedTextColor">?android:textColorPrimary</item>
</style>
как будет я затем использовать FloatingActionButton в моей деятельности? я изменю способ, которым я вызываю панель инструментов и tablayout, так как они теперь находятся в AppBarLayout? –
Удалите FloatingActionButton, если вам это не нужно. Панель инструментов панели инструментов (панель инструментов) findViewById (R.id.toolbar); setSupportActionBar (панель инструментов); TabLayout tabLayout = (TabLayout) findViewById (R.id.tabs); tabLayout.setupWithViewPager (mViewPager); – Sunny
сталкиваются с ошибками в стилях. ** не может решить стиль ** @ style/AppTheme.PopupOverlay –