本文整理汇总了Java中android.app.ActionBar.setDisplayOptions方法的典型用法代码示例。如果您正苦于以下问题:Java ActionBar.setDisplayOptions方法的具体用法?Java ActionBar.setDisplayOptions怎么用?Java ActionBar.setDisplayOptions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.app.ActionBar
的用法示例。
在下文中一共展示了ActionBar.setDisplayOptions方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupActionBar
import android.app.ActionBar; //导入方法依赖的package包/类
private void setupActionBar() {
ActionBar actionBar = getActionBar();
if (actionBar != null) {
actionBar.setCustomView(R.layout.action_bar);
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
actionBar.getCustomView().findViewById(R.id.action_bar_back_icon).setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed();
}
});
}
}
示例2: setupActionBar
import android.app.ActionBar; //导入方法依赖的package包/类
public static void setupActionBar(ActionBar actionBar, int rLogoId) {
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME
| ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_TITLE);
actionBar.setHomeButtonEnabled(true);
// NOTE:
// There is a bug in the handling of ActionView (SearchView) icon inside ActionBarImpl, so
// we have to workaround it by setting the icon to logo programmatically.
actionBar.setIcon(rLogoId);
}
示例3: setupActionBarDoneCancel
import android.app.ActionBar; //导入方法依赖的package包/类
public static void setupActionBarDoneCancel(int layoutId,
Activity activity,
int doneId,
View.OnClickListener onDoneListener,
int cancelId,
View.OnClickListener onCancelListener) {
ActionBar actionBar = activity.getActionBar();
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
actionBar.setCustomView(makeDoneCancelLayout(layoutId, activity,
doneId, onDoneListener,
cancelId, onCancelListener));
}
示例4: onCreate
import android.app.ActionBar; //导入方法依赖的package包/类
/**
* @brief This is the onCreate method
* @param savedInstanceState
* @details The onCreate method adds an actionBar the show title and the home display
*/
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.help);
//efectos del actionBar
final ActionBar actionBar = getActionBar();
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE|ActionBar.DISPLAY_SHOW_HOME|ActionBar.DISPLAY_HOME_AS_UP);
}
示例5: setupActionBarNoUp
import android.app.ActionBar; //导入方法依赖的package包/类
public static void setupActionBarNoUp(ActionBar actionBar, int rLogoId) {
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE);
actionBar.setHomeButtonEnabled(false);
actionBar.setIcon(rLogoId);
}
示例6: onClick
import android.app.ActionBar; //导入方法依赖的package包/类
public void onClick(View v) {
final ActionBar bar = getActionBar();
int flags = 0;
switch (v.getId()) {
case R.id.toggle_home_as_up:
flags = ActionBar.DISPLAY_HOME_AS_UP;
break;
case R.id.toggle_show_home:
flags = ActionBar.DISPLAY_SHOW_HOME;
break;
case R.id.toggle_use_logo:
flags = ActionBar.DISPLAY_USE_LOGO;
break;
case R.id.toggle_show_title:
flags = ActionBar.DISPLAY_SHOW_TITLE;
break;
case R.id.toggle_show_custom:
flags = ActionBar.DISPLAY_SHOW_CUSTOM;
break;
case R.id.toggle_navigation:
bar.setNavigationMode(
bar.getNavigationMode() == ActionBar.NAVIGATION_MODE_STANDARD
? ActionBar.NAVIGATION_MODE_TABS
: ActionBar.NAVIGATION_MODE_STANDARD);
return;
case R.id.cycle_custom_gravity:
ActionBar.LayoutParams lp = (ActionBar.LayoutParams) mCustomView.getLayoutParams();
int newGravity = 0;
switch (lp.gravity & Gravity.HORIZONTAL_GRAVITY_MASK) {
case Gravity.LEFT:
newGravity = Gravity.CENTER_HORIZONTAL;
break;
case Gravity.CENTER_HORIZONTAL:
newGravity = Gravity.RIGHT;
break;
case Gravity.RIGHT:
newGravity = Gravity.LEFT;
break;
}
lp.gravity = lp.gravity & ~Gravity.HORIZONTAL_GRAVITY_MASK | newGravity;
bar.setCustomView(mCustomView, lp);
return;
}
int change = bar.getDisplayOptions() ^ flags;
bar.setDisplayOptions(change, flags);
}
示例7: onCreate
import android.app.ActionBar; //导入方法依赖的package包/类
/**
* @brief This is the onCreate method
* @param savedInstanceState
* @details The onCreate method adds two switches to control the remember exit,
* and the show of the cursor
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.configuration);
Switch checkBox = (Switch) findViewById(R.id.checkbox_remember);
Switch checkBoxHide = (Switch) findViewById(R.id.checkbox_hidemouse);
checkBox.setChecked((Configuration.getInstance()).isRememberExit());
checkBoxHide.setChecked((Configuration.getInstance()).isHideMouse());
//efectos del actionBar
final ActionBar actionBar = getActionBar();
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE|ActionBar.DISPLAY_SHOW_HOME|ActionBar.DISPLAY_HOME_AS_UP);
}
示例8: onCreate
import android.app.ActionBar; //导入方法依赖的package包/类
/**
* @brief This is the onCreate method
* @param savedInstanceState
* @details The onCreate method adds an actionBar to the activity with two tabs (recent and favorites).
* It also load the preferences file into the prefs attribute and sets the rememeberExit attribute.
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.tab_host);
final ActionBar actionBar = getActionBar();
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE|ActionBar.DISPLAY_SHOW_HOME);
final String recents = getString(R.string.recents);
final String favorites = getString(R.string.favoritesTab);
// add tabs
Tab tab1 = actionBar.newTab()
.setText(recents)
.setTabListener(new TabListener<ListFragmentTab>(
this, "tab1", ListFragmentTab.class));
actionBar.addTab(tab1);
Tab tab2 = actionBar.newTab()
.setText(favorites)
.setTabListener(new TabListener<ListFragmentTabFav>(
this, "tab2", ListFragmentTabFav.class));
actionBar.addTab(tab2);
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
//accedemos a fichero preferencias
(Configuration.getInstance()).setPrefs( getSharedPreferences("PreferencesFile",Context.MODE_PRIVATE));
(Configuration.getInstance()).readPrefs();
// Orientation Change Occurred
if(savedInstanceState!=null){
int currentTabIndex = savedInstanceState.getInt("tab_index");
actionBar.setSelectedNavigationItem(currentTabIndex);
}
//nombre en la activity bar
final String title = getString(R.string.connections);
setTitle(title);
}