當前位置: 首頁>>代碼示例>>Java>>正文


Java ActionBar.setTitle方法代碼示例

本文整理匯總了Java中android.app.ActionBar.setTitle方法的典型用法代碼示例。如果您正苦於以下問題:Java ActionBar.setTitle方法的具體用法?Java ActionBar.setTitle怎麽用?Java ActionBar.setTitle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.app.ActionBar的用法示例。


在下文中一共展示了ActionBar.setTitle方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setTitle

import android.app.ActionBar; //導入方法依賴的package包/類
@TargetApi(11)
public static void setTitle(ActionBar actionBar, SpannableString spannableString) {
	// BUGFIX
	// @see http://stackoverflow.com/questions/7658725/android-java-lang-illegalargumentexception-invalid-payload-item-type
	if (Build.VERSION.SDK_INT == Build.VERSION_CODES.JELLY_BEAN && Build.MANUFACTURER.toUpperCase().equals("LGE")) {
		actionBar.setTitle(spannableString.toString());
	} else {
		actionBar.setTitle(spannableString);
	}
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:11,代碼來源:ActionBarHelper.java

示例2: onCreateOptionsMenu

import android.app.ActionBar; //導入方法依賴的package包/類
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    ActionBar actionBar = getActivity().getActionBar();
    if (actionBar != null) {
        actionBar.setTitle(R.string.notification_settings);
        actionBar.setDisplayHomeAsUpEnabled(true);
    }
}
 
開發者ID:RikkaApps,項目名稱:FCM-for-Mojo,代碼行數:9,代碼來源:NotificationSettingsFragment.java

示例3: onCreateOptionsMenu

import android.app.ActionBar; //導入方法依賴的package包/類
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    ActionBar actionBar = getActivity().getActionBar();
    if (actionBar != null) {
        actionBar.setTitle(R.string.server_settings);
        actionBar.setDisplayHomeAsUpEnabled(true);
    }
}
 
開發者ID:RikkaApps,項目名稱:FCM-for-Mojo,代碼行數:9,代碼來源:ServerSettingsFragment.java

示例4: onCreateOptionsMenu

import android.app.ActionBar; //導入方法依賴的package包/類
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    ActionBar actionBar = getActivity().getActionBar();
    if (actionBar != null) {
        actionBar.setTitle(R.string.activity_name);
        actionBar.setDisplayHomeAsUpEnabled(false);
    }
}
 
開發者ID:RikkaApps,項目名稱:FCM-for-Mojo,代碼行數:9,代碼來源:MainSettingsFragment.java

示例5: toggleSelection

import android.app.ActionBar; //導入方法依賴的package包/類
void toggleSelection(ActionBar actionBar, int position, String packageName) {

        if (mSelections.contains(packageName)) {

            mSelections.remove(packageName);
        } else {
            mSelections.add(packageName);
        }
        if (!mSelections.isEmpty()) {
            actionBar.setTitle(String.valueOf(mSelections.size()) + mContext.getString(R.string.hide_app_selected));
        } else {
            actionBar.setTitle(mContext.getString(R.string.hidden_app));
        }
        notifyItemChanged(position);
    }
 
開發者ID:enricocid,項目名稱:LaunchEnr,代碼行數:16,代碼來源:SelectableAdapter.java

示例6: initActionBar

import android.app.ActionBar; //導入方法依賴的package包/類
protected void initActionBar(){
    ActionBar ab = getActionBar();
    if (ab!=null)
    {
        ab.setTitle(getString(R.string.thread_details_activity_title));
        ab.setHomeButtonEnabled(true);
    }
}
 
開發者ID:MobileDev418,項目名稱:AndroidBackendlessChat,代碼行數:9,代碼來源:ChatSDKThreadDetailsActivity.java

示例7: initActionBar

import android.app.ActionBar; //導入方法依賴的package包/類
protected void initActionBar(){
    ActionBar ab = getActionBar();
    if (ab!=null)
    {
        ab.setTitle(getString(R.string.pick_friends));
        ab.setHomeButtonEnabled(true);
    }
}
 
開發者ID:MobileDev418,項目名稱:AndroidBackendlessChat,代碼行數:9,代碼來源:ChatSDKPickFriendsActivity.java

示例8: onActivityCreated

import android.app.ActionBar; //導入方法依賴的package包/類
/** This is where we perform additional setup for the fragment that's either
 * not related to the fragment's layout or must be done after the layout is drawn.
 */
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    // Set member variable for whether this fragment is the only one in the activity
    Fragment listFragment = getFragmentManager().findFragmentById(R.id.titles_frag);
    mSoloFragment = listFragment == null ? true : false;

    if (mSoloFragment) {
        // The fragment is alone, so enable up navigation
        getActivity().getActionBar().setDisplayHomeAsUpEnabled(true);
        // Must call in order to get callback to onOptionsItemSelected()
        setHasOptionsMenu(true);
    }

    // Current position and UI visibility should survive screen rotations.
    if (savedInstanceState != null) {
        setSystemUiVisible(savedInstanceState.getBoolean("systemUiVisible"));
        if (mSoloFragment) {
            // Restoring these members is not necessary when this fragment
            // is combined with the TitlesFragment, because when the TitlesFragment
            // is restored, it selects the appropriate item and sends the event
            // to the updateContentAndRecycleBitmap() method itself
            mCategory = savedInstanceState.getInt("category");
            mCurPosition = savedInstanceState.getInt("listPosition");
            updateContentAndRecycleBitmap(mCategory, mCurPosition);
        }
    }

    if (mSoloFragment) {
      String title = Directory.getCategory(mCategory).getEntry(mCurPosition).getName();
      ActionBar bar = getActivity().getActionBar();
      bar.setTitle(title);
    }
}
 
開發者ID:sdrausty,項目名稱:buildAPKsSamples,代碼行數:39,代碼來源:ContentFragment.java

示例9: onCreate

import android.app.ActionBar; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.recyclerview);
    recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        ActionBar actionBar = getActionBar();
        if (actionBar != null) {
            actionBar.setTitle("RecyclerView");
        }
    }

    // Layout Managers:
    recyclerView.setLayoutManager(new LinearLayoutManager(this));

    // Item Decorator:
    recyclerView.addItemDecoration(new DividerItemDecoration(getResources().getDrawable(R.drawable.divider)));
    recyclerView.setItemAnimator(new DefaultItemAnimator());

    // Adapter:
    String[] adapterData = new String[]{"Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut", "Delaware", "Florida", "Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", "Michigan", "Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire", "New Jersey", "New Mexico", "New York", "North Carolina", "North Dakota", "Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island", "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "Vermont", "Virginia", "Washington", "West Virginia", "Wisconsin", "Wyoming"};
    mDataSet = new ArrayList<String>(Arrays.asList(adapterData));
    mAdapter = new RecyclerViewAdapter(this, recyclerView, mDataSet);
    ((RecyclerViewAdapter) mAdapter).setMode(Attributes.Mode.Single);
    recyclerView.setAdapter(mAdapter);

    try {
        new ItemTouchBuilder()
                .setList(mDataSet)
                .setAdapter(mAdapter)
                .setSwappable(false)
                .create(recyclerView)
                .attachToRecyclerView(recyclerView);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
開發者ID:ymqq,項目名稱:CommonFramework,代碼行數:38,代碼來源:RecyclerViewExample.java

示例10: onCreate

import android.app.ActionBar; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_attraction_list);
    ButterKnife.bind(this, this);

    setActionBar(toolbar);

    ActionBar actionBar = getActionBar();
    if (actionBar != null) {
        actionBar.setTitle(getString(R.string.app_title_mm));
    }

    mAttractionAdapter = new AttractionAdapter(getApplicationContext(), this);
    rvAttractions.setAdapter(mAttractionAdapter);

    LinearLayoutManager verticalSingleColumnLM = new LinearLayoutManager(getApplicationContext(), LinearLayoutManager.VERTICAL, false);
    rvAttractions.setLayoutManager(verticalSingleColumnLM);

    mAttractionsModel = ViewModelProviders.of(this).get(AttractionsModel.class);
    mAttractionsModel.initDatabase(getApplicationContext());
    mAttractionsModel.getAttractions().observe(this, new Observer<List<AttractionVO>>() {
        @Override
        public void onChanged(@Nullable List<AttractionVO> attractionVOs) {
            mAttractionAdapter.setNewData(attractionVOs);
        }
    });
}
 
開發者ID:agpyaephyo,項目名稱:PADC-MyanmarAttractions-AC,代碼行數:29,代碼來源:AttractionListActivity.java

示例11: onCreate

import android.app.ActionBar; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);

    // Get preferences
    SharedPreferences preferences =
        PreferenceManager.getDefaultSharedPreferences(this);

    boolean darkTheme =
        preferences.getBoolean(Diary.PREF_DARK_THEME, false);

    if (darkTheme)
        setTheme(R.style.AppDarkTheme);

    // Display the fragment as the main content.
    getFragmentManager().beginTransaction()
    .replace(android.R.id.content, new SettingsFragment())
    .commit();

    // Enable back navigation on action bar
    ActionBar actionBar = getActionBar();
    if (actionBar != null)
    {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setTitle(R.string.settings);
    }
}
 
開發者ID:billthefarmer,項目名稱:diary,代碼行數:29,代碼來源:Settings.java


注:本文中的android.app.ActionBar.setTitle方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。