Note that there are some explanatory texts on larger screens.

plurals
  1. POUse One Common Button across Fragments with ActionBarSherlock
    primarykey
    data
    text
    <p>I used ActionBarSherlock to get some Holo Themed Tabs and an ActionBar on my app and created a Fragment to handle the behavior on each tab. I wanted the tabs and a button along the bottom to "sandwich" the fragments do at the bottom of the screen there would be a button that would have one click listener across both fragments.</p> <p>In my Activity I created the tabs like this.</p> <pre><code>public class InviteFriendsActivity extends SherlockFragmentActivity implements ActionBar.TabListener { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ActionBar bar = getSupportActionBar(); bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); ActionBar.Tab tab1 = bar.newTab(); tab1.setText("Tab 1"); tab1.setTabListener(this); ActionBar.Tab tab2 = bar.newTab(); tab2.setText("Tab 2"); tab2.setTabListener(this); bar.addTab(tab1); bar.addTab(tab2); } } </code></pre> <p>And then I created the onTabSelected</p> <pre><code> public void onTabSelected(Tab tab, FragmentTransaction ft) { if (tab.getPosition() == 0) { Fragment1 frag = new Fragment1(); ft.replace(android.R.id.content, frag); } else if (tab.getPosition() == 1) { Fragment2 frag = new Fragment2(); ft.replace(android.R.id.content, frag); } } </code></pre> <p>I have no problem getting the tabs to display or change, but I can't seem to figure out how to get a button the would line the bottom of the screen and stay static while inside this activity and still allow me to switch between the two fragments. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload