2016-02-03 2 views
0

Я реализовал код add Spinner to Toolbar используя пользовательский адаптер увидеть это postКак добавить Spinner на панель инструментов субтитров

enter image description here

Но теперь мне нужно добавить такую ​​же spinner to Subtitle of Toolbar, Здесь мне нужна ваша помощь ... не могли бы вы рассказать?

toolbar.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" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:id="@+id/toolbar" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:background="?attr/colorPrimaryDark" 
    android:minHeight="?attr/actionBarSize" 
    app:popupTheme="@style/ThemeOverlay.AppCompat.Light" 
    > 

    <Spinner 
     android:id="@+id/spinner_nav" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" /> 

</android.support.v7.widget.Toolbar> 
+0

может я знаю причину ?? DOWNVOTE – Sophie

+0

Вы уже добавили Spinner к субтитрам панели инструментов. то в чем проблема? –

+0

Ответ очень прост, возьмите 'LinearLayout' insdie, который положил 2 прядильщика –

ответ

2

Проверить это

<?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" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:id="@+id/toolbar" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:background="?attr/colorPrimaryDark" 
    android:minHeight="?attr/actionBarSize" 
    app:popupTheme="@style/ThemeOverlay.AppCompat.Light" 
    > 

    <LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:orientation="vertical"> 


    <TextView 
     android:id="@+id/tv_title" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" /> 
    <Spinner 
     android:id="@+id/spinner_nav_sub" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" /> 

</LinearLayout> 

</android.support.v7.widget.Toolbar> 
Смежные вопросы