当前位置: 首页>>代码示例>>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;未经允许,请勿转载。