Tente algo assim na sua activity_main.xml



-- <LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.Toolbar
android:id="@+id/main_activity_toolbar"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
...
/>
<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/item_list"
android:name="lasoftwares.samplesqlite.ItemListFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
tools:context=".ItemListActivity"
tools:layout="@android:layout/list_content" />
</LinearLayout>
E controle a toolbar pela Activity, não pelo Fragment.
Se precisar acessar a toolbar pelo fragment, faça um getToolbar() na Activity e acesse por ((MainActivity) getActivity())...;
Se precisar acessar a toolbar pelo fragment, faça um getToolbar() na Activity e acesse por ((MainActivity) getActivity())...;
[]'s
Att,
Rafael de Araújo
Em 8 de julho de 2015 10:22, Luciano Pimenta <lucianoalmeidapimenta@gmail.com> escreveu:
Obriga Rafael,--Tentei adicionar no arquivo activity_item_list.xml, mas tenho erro.O arquivo está assim:<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/item_list"
android:name="lasoftwares.samplesqlite.ItemListFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
tools:context=".ItemListActivity"
tools:layout="@android:layout/list_content" />
Em quarta-feira, 8 de julho de 2015 09:28:04 UTC-3, Rafael de Araújo escreveu:Já tentou setar essa toolbar na activity onde ficam os containers dos fragments?AbraçosAtt,Rafael de Araújo2015-07-08 9:00 GMT-03:00 Luciano Pimenta <lucianoalm...@gmail.com>:Quando criava projetos com o template master/detail, na tela principal, existia uma ActionBar.--Agora, ao criar o projeto, na principal não temos mais ActionBar, apenas nos Fragments.Alguém sabe se ainda é possível colocar uma ActionBar/Toolbar na tela principal da Master/detail?AttLuciano Pimenta
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.






0 comentários:
Postar um comentário