Or is this related to the actionbar i am using? here is a complete
Mainactivity.java
package com.yoplus.customer;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.app.ActionBar;
import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentTransaction;
import android.support.v4.app.FragmentActivity;
import android.view.Menu;
import android.view.Window;
import android.app.ActionBar.Tab;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.widget.TabHost;
import android.widget.Toast;
import android.widget.TabHost.OnTabChangeListener;
class MyTabsListener implements ActionBar.TabListener {
public Fragment fragment;
public MyTabsListener(Fragment fragment) {
this.fragment = fragment;
}
public void onTabReselected(Tab tab, FragmentTransaction ft) {
Toast.makeText(MainActivity.appContext, "Reselected!",
Toast.LENGTH_LONG).show();
}
public void onTabSelected(Tab tab, FragmentTransaction ft) {
ft.replace(R.id.fragment_container, fragment);
}
public void onTabUnselected(Tab tab, FragmentTransaction ft) {
ft.remove(fragment);
}
}
public class MainActivity extends Activity{
public static Context appContext;
double currentLat, currentLong;
Boolean getCurrentLocation = false;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ActionBar actionbar = getActionBar();
actionbar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
actionbar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM,
ActionBar.DISPLAY_SHOW_CUSTOM);
ActionBar.Tab SearchTab1 = actionbar.newTab().setText("Search");
ActionBar.Tab StationsTab1 = actionbar.newTab().setText("wallet");
ActionBar.Tab StationsTab2 = actionbar.newTab().setText("Rewards");
ActionBar.Tab StationsTab3 = actionbar.newTab().setText("setting");
Fragment searchFragment = new AFragment();
Fragment StationsFragment = new AFragment();
SearchTab1.setTabListener(new MyTabsListener(searchFragment));
StationsTab1.setTabListener(new MyTabsListener(StationsFragment));
StationsTab2.setTabListener(new MyTabsListener(StationsFragment));
StationsTab3.setTabListener(new MyTabsListener(StationsFragment));
actionbar.addTab(SearchTab1);
actionbar.addTab(StationsTab1);
actionbar.addTab(StationsTab2);
actionbar.addTab(StationsTab3);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}
Hi,
> I tried to add uiOptions, as my manifest file is as follows:
>
> <uses-sdk
> android:minSdkVersion="11"
> android:targetSdkVersion="15" />
>
> <application
> android:icon="@drawable/ic_launcher"
> android:label="@string/app_name"
> android:theme="@android:style/Theme.Holo"
> android:uiOptions="splitActionBarWhenNarrow" >
> <activity
> android:name=".MainActivity"
> android:label="@string/title_activity_main"
> android:layout_gravity="bottom">
> <intent-filter>
> <action android:name="android.intent.action.MAIN" />
>
> <category android:name="android.intent.category.LAUNCHER"
> />
> </intent-filter>
> </activity>
> <activity android:name=".MerchantTab" />
> <activity android:name=".ConsumerTab" />
> <activity android:name=".MyWallet" />
> <activity android:name=".MerchantDetailsTab" />
> </application>
>
> ~~~~~~~~~~~~~~~
> in mainAcitivity:
> public void onCreate(Bundle savedInstanceState) {
> super.onCreate(savedInstanceState);
> setContentView(R.layout.activity_main);
>
> Anything else I might miss here?
>
> Thanks
> Summer
>
>
> On Mon, Jan 14, 2013 at 6:39 PM, Summer <[email protected]> wrote:
>
>> > Hi, I am trying to use actionbar to generate tabs at bottom of the
>> page. It
>> > works fine to show the tabs at the top. but how to put it at bottom?
>>
>> Use android:uiOptions="splitActionBarWhenNarrow" on your <activity> or
>> <application>.
>>
>> > I tried " android:uiOptions="splitActionBarWhenNarrow"" at Manifest
>> file.
>>
>> This will only take effect in situations where the OS considers the
>> display to be "narrow". Typically, that is a phone-sized screen in
>> portrait. In all other circumstances, the action bar is not split.
>>
>> There is no other means of putting an "action bar" at the bottom.
>>
>> --
>> Mark Murphy (a Commons Guy)
>> http://commonsware.com | http://github.com/commonsguy
>> http://commonsware.com/blog | http://twitter.com/commonsguy
>>
>> Localized Android Question-and-Answer Sites: http://www.andglobe.com
>>
>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en