Reputation: 2623
I am using an Activity which has 3 fragment.Back Arrow is visible because of using the following line.
android:parentActivityName=".Activity.MainActivity"
. But I need to hide this <--(Back Arrow) only for a particular fragment abd it has to be visible in another 2 fragment. What do I need to do?
Upvotes: 2
Views: 1717
Reputation: 4959
Use this line of code in your fragment onCreateView() where you want to remove the back button
getActivity().getActionBar().setDisplayHomeAsUpEnabled(false);
or
((AppCompatActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(false);
Upvotes: 4
Reputation: 3347
try this code in your fragment:
getActivity().getActionBar().setDisplayHomeAsUpEnabled(false);
Upvotes: 2