I want to implement a three tab screen inside a fragment (TabFragement). I am importing android.support.v4.app.FragmentTabHost
and android.support.v4.app.Fragment
when creating a tabhost inside the fragment.
When I try to call the fragment (TabFragement) using an activity, in
fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit();
the method 'replace' wants to have a fragment of android.app.Fragment.
So, how should I solve this matter?
Any sugegstions?
Thank you.
To solve the import problem you need to extends FragmentActivity
. FragmentActivity
was added to allow the use of Fragments
from the support library in your Activities
.
Also, make sure you use getSupportFragmentManager()
instead.
i think you have to take only Fragment instead FragmentTabhost and add tabhost to your fragmentlayout.xml and in fragment.java class take that tabhost object and create tabbar. thats it...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.