android.app.ActionBar#setDisplayHomeAsUpEnabled ( )源码实例Demo

下面列出了android.app.ActionBar#setDisplayHomeAsUpEnabled ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_service_list);

    ActionBar actionBar = getActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_HOME);
        actionBar.setTitle(R.string.activity_service_list_title);
    }

    mManualActivity = getSettingManualActivityClass();

    bindMessageService();
}
 
源代码2 项目: VIA-AI   文件: DeveloperSettingFragment.java
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Resources resource = getResources();

    // set name of actionbar.
    ActionBar actionBar = getActivity().getActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setTitle(resource.getString(R.string.prefTitle_Developer));
    }

    // load default value
    PreferenceManager.setDefaultValues(getActivity(), R.xml.pref_developer_setting, false);

    // config xml
    addPreferencesFromResource(R.xml.pref_developer_setting);
}
 
源代码3 项目: Blackbulb   文件: MoreSettingsActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    Settings settings = Settings.getInstance(this);

    if (settings.isDarkTheme()) {
        setTheme(android.R.style.Theme_Material);
    }

    super.onCreate(savedInstanceState);

    final ActionBar actionBar = getActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setSubtitle(R.string.app_name);
    }

    getFragmentManager().beginTransaction()
            .replace(android.R.id.content, new SettingsFragment())
            .commit();
}
 
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_packages_selector_content);

    final Intent intent = getIntent();
    if (intent != null) {
        mLastSelectedPackages = intent.getStringArrayListExtra(EXTRA_SELECTED);
    }

    final ActionBar actionBar = requireNonNull(getActionBar());
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setHomeAsUpIndicator(R.drawable.ic_close_black_24dp);

    mRecyclerView = findViewById(android.R.id.list);
    mProgressBar = findViewById(android.R.id.progress);

    mAdapter.onRestoreInstanceState(savedInstanceState);
    mRecyclerView.setAdapter(mAdapter);

    if (savedInstanceState == null) {
        loadAppInfoListAsync();
    }
}
 
源代码5 项目: currency   文件: SettingsFragment.java
@Override
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,
                                     Preference preference)
{
    boolean result =
        super.onPreferenceTreeClick(preferenceScreen, preference);

    // Set home as up
    if (preference instanceof PreferenceScreen)
    {
        Dialog dialog = ((PreferenceScreen) preference).getDialog();
        ActionBar actionBar = dialog.getActionBar();
        actionBar.setDisplayHomeAsUpEnabled(false);
    }

    return result;
}
 
源代码6 项目: Bitocle   文件: WebViewActivity.java
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.webview);

    Intent intent = getIntent();
    String title = intent.getStringExtra(getString(R.string.webview_intent_title));
    String subTitle = intent.getStringExtra(getString(R.string.webview_intent_subtitle));

    ActionBar actionBar = getActionBar();
    actionBar.setTitle(title);
    actionBar.setSubtitle(subTitle);
    actionBar.setDisplayShowHomeEnabled(false);
    actionBar.setDisplayHomeAsUpEnabled(true);

    fragment = (WebViewFragment) getSupportFragmentManager().findFragmentById(R.id.webview_fragment);
}
 
源代码7 项目: XInstaller   文件: Preferences.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup parent,
                         Bundle savedInstanceState) {
    super.onCreateView(inflater, parent, savedInstanceState);

    WebView v = new WebView(getActivity());

    ActionBar ab = getActivity().getActionBar();
    if (ab != null) {
        ab.setDisplayHomeAsUpEnabled(true);
        ab.setHomeButtonEnabled(true);
    }
    return v;
}
 
源代码8 项目: VIA-AI   文件: CameraSettingFragment.java
@Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
      View view = super.onCreateView(inflater, container, savedInstanceState);
//      view.setBackgroundColor(getResources().getColor(R.color.prefBkg_CameraResource));

      // set name of actionbar.
      ActionBar actionBar = getActivity().getActionBar();
      if (actionBar != null) {
          actionBar.setDisplayHomeAsUpEnabled(true);
          actionBar.setTitle(getResources().getString(R.string.prefTitle_CameraSource));
      }
      return view;
  }
 
源代码9 项目: HeadFirstAndroid   文件: OrderActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_order);
    ActionBar actionBar = getActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
}
 
private void setupActionBarAttributes() {
    final ActionBar actionBar = getActionBar();
    if (actionBar == null) {
        return;
    }

    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setHomeButtonEnabled(true);
}
 
源代码11 项目: something.apk   文件: PreviewActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.reply_preview_activity);
    ActionBar ab = getActionBar();
    if(ab != null){
        ab.setHomeButtonEnabled(true);
        ab.setDisplayHomeAsUpEnabled(true);
    }
}
 
private void renderBlockDetail(final BlockInfoEx blockInfo) {
    ListAdapter listAdapter = mListView.getAdapter();
    final DetailAdapter adapter;
    if (listAdapter instanceof DetailAdapter) {
        adapter = (DetailAdapter) listAdapter;
    } else {
        adapter = new DetailAdapter();
        mListView.setAdapter(adapter);
        mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                adapter.toggleRow(position);
            }
        });
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            invalidateOptionsMenu();
            ActionBar actionBar = getActionBar();
            if (actionBar != null) {
                actionBar.setDisplayHomeAsUpEnabled(true);
            }
        }
        mActionButton.setVisibility(VISIBLE);
        mActionButton.setText(R.string.block_canary_delete);
    }
    mActionButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (blockInfo != null) {
                blockInfo.logFile.delete();
                mBlockStartTime = null;
                mBlockInfoEntries.remove(blockInfo);
                updateUi();
            }
        }
    });
    adapter.update(blockInfo);
    setTitle(getString(R.string.block_canary_class_has_blocked, blockInfo.timeCost));
}
 
源代码13 项目: VIA-AI   文件: SystemSettingFragment.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = super.onCreateView(inflater, container, savedInstanceState);

    // set name of actionbar.
    ActionBar actionBar = getActivity().getActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setTitle(getResources().getString(R.string.prefTitle_System));
    }
    return view;
}
 
源代码14 项目: Android-Keyboard   文件: SettingsActivity.java
@Override
protected void onCreate(final Bundle savedState) {
    super.onCreate(savedState);
    final ActionBar actionBar = getActionBar();
    final Intent intent = getIntent();
    if (actionBar != null) {
        mShowHomeAsUp = intent.getBooleanExtra(EXTRA_SHOW_HOME_AS_UP, true);
        actionBar.setDisplayHomeAsUpEnabled(mShowHomeAsUp);
        actionBar.setHomeButtonEnabled(mShowHomeAsUp);
    }
    StatsUtils.onSettingsActivity(
            intent.hasExtra(EXTRA_ENTRY_KEY) ? intent.getStringExtra(EXTRA_ENTRY_KEY)
                    : EXTRA_ENTRY_VALUE_SYSTEM_SETTINGS);
}
 
@Override
protected void onCreate(final Bundle savedState) {
    super.onCreate(savedState);
    final ActionBar actionBar = getActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setHomeButtonEnabled(true);
    }
}
 
源代码16 项目: Noyze   文件: ConfigurationActivity.java
public static void setupActionBar(Activity activity) {

        // Tint the status bar, if available.
        SystemBarTintManager tintManager = new SystemBarTintManager(activity);
        tintManager.setStatusBarTintEnabled(true);
        tintManager.setTintColor(activity.getResources().getColor(R.color.action_bar_dark));

        ActionBar actionBar = activity.getActionBar();
        if (null != actionBar) {
            actionBar.setIcon(DateUtils.AppIcon());
            actionBar.setDisplayHomeAsUpEnabled(!activity.isTaskRoot());
            actionBar.setDisplayShowTitleEnabled(true);
        }
    }
 
源代码17 项目: ShareLocationPlugin   文件: ShowLocationActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	ActionBar actionBar = getActionBar();
	if (actionBar != null) {
		actionBar.setDisplayHomeAsUpEnabled(true);
	}

	setContentView(R.layout.show_locaction_activity);
	MapFragment fragment = (MapFragment) getFragmentManager().findFragmentById(R.id.map_fragment);
	fragment.getMapAsync(this);
}
 
@Override
protected void onCreate(Bundle state) {
    super.onCreate(state);

    setContentView(R.layout.a_example_details);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        ActionBar ab = getActionBar();
        if (ab != null) {
            ab.setDisplayHomeAsUpEnabled(true);
        }
    }
}
 
源代码19 项目: MoeGallery   文件: LicensesActivity.java
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_licenses);

    ActionBar actionBar = getActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
    }

    webView = (WebView) findViewById(R.id.webView);
    webView.loadUrl("file:///android_res/raw/licenses.html");
}
 
源代码20 项目: prettygoodmusicplayer   文件: SettingsActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	ActionBar actionBar = getActionBar();
	actionBar.setDisplayHomeAsUpEnabled(true);
}