Search in sources :

Example 61 with Toolbar

use of android.support.v7.widget.Toolbar in project CloudReader by youlookwhat.

the class MainActivity method initContentFragment.

private void initContentFragment() {
    ArrayList<Fragment> mFragmentList = new ArrayList<>();
    mFragmentList.add(new GankFragment());
    mFragmentList.add(new OneFragment());
    mFragmentList.add(new BookFragment());
    // 注意使用的是:getSupportFragmentManager
    MyFragmentPagerAdapter adapter = new MyFragmentPagerAdapter(getSupportFragmentManager(), mFragmentList);
    vpContent.setAdapter(adapter);
    // 设置ViewPager最大缓存的页面个数(cpu消耗少)
    vpContent.setOffscreenPageLimit(2);
    vpContent.addOnPageChangeListener(this);
    mBinding.include.ivTitleGank.setSelected(true);
    vpContent.setCurrentItem(0);
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        //去除默认Title显示
        actionBar.setDisplayShowTitleEnabled(false);
    }
}
Also used : GankFragment(com.example.jingbin.cloudreader.ui.gank.GankFragment) MyFragmentPagerAdapter(com.example.jingbin.cloudreader.view.MyFragmentPagerAdapter) ArrayList(java.util.ArrayList) OneFragment(com.example.jingbin.cloudreader.ui.one.OneFragment) BookFragment(com.example.jingbin.cloudreader.ui.book.BookFragment) GankFragment(com.example.jingbin.cloudreader.ui.gank.GankFragment) BookFragment(com.example.jingbin.cloudreader.ui.book.BookFragment) Fragment(android.support.v4.app.Fragment) OneFragment(com.example.jingbin.cloudreader.ui.one.OneFragment) ActionBar(android.support.v7.app.ActionBar)

Example 62 with Toolbar

use of android.support.v7.widget.Toolbar in project Android-skin-support by ximsfei.

the class BaseActivity method initToolbar.

protected void initToolbar() {
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    toolbar.setTitle("Title");
    toolbar.setSubtitle("Subtitle");
    toolbar.setNavigationIcon(R.drawable.ic_settings_36dp);
}
Also used : Toolbar(android.support.v7.widget.Toolbar)

Example 63 with Toolbar

use of android.support.v7.widget.Toolbar in project LookLook by xinghongfei.

the class MainActivity method animateToolbar.

private void animateToolbar() {
    // this is gross but toolbar doesn't expose it's children to animate them :(
    View t = toolbar.getChildAt(0);
    if (t != null && t instanceof TextView) {
        TextView title = (TextView) t;
        // fade in and space out the title.  Animating the letterSpacing performs horribly so
        // fake it by setting the desired letterSpacing then animating the scaleX ¯\_(ツ)_/¯
        title.setAlpha(0f);
        title.setScaleX(0.8f);
        title.animate().alpha(1f).scaleX(1f).setStartDelay(500).setDuration(900).setInterpolator(AnimUtils.getFastOutSlowInInterpolator(this)).start();
    }
    View amv = toolbar.getChildAt(1);
    if (amv != null & amv instanceof ActionMenuView) {
        ActionMenuView actions = (ActionMenuView) amv;
        // filter
        popAnim(actions.getChildAt(0), 500, 200);
        // overflow
        popAnim(actions.getChildAt(1), 700, 200);
    }
}
Also used : TextView(android.widget.TextView) ActionMenuView(android.support.v7.widget.ActionMenuView) NavigationView(android.support.design.widget.NavigationView) BindView(butterknife.BindView) View(android.view.View) ActionMenuView(android.support.v7.widget.ActionMenuView) TextView(android.widget.TextView)

Example 64 with Toolbar

use of android.support.v7.widget.Toolbar in project PhotoNoter by yydcdut.

the class SettingActivity method initToolBarUI.

private void initToolBarUI() {
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    toolbar.setTitle(getResources().getString(R.string.app_setting));
    toolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_24dp);
    AppCompat.setElevation(toolbar, getResources().getDimension(R.dimen.ui_elevation));
}
Also used : Toolbar(android.support.v7.widget.Toolbar)

Example 65 with Toolbar

use of android.support.v7.widget.Toolbar in project PhotoNoter by yydcdut.

the class UserCenterActivity method initToolBarUI.

private void initToolBarUI() {
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setTitle(getResources().getString(R.string.personal_page));
    toolbar.setTitleTextColor(AppCompat.getColor(R.color.txt_gray, this));
    toolbar.setBackgroundColor(AppCompat.getColor(android.R.color.white, this));
    setSupportActionBar(toolbar);
    toolbar.setNavigationIcon(R.drawable.ic_arrow_back_gray_24dp);
    toolbar.setOnMenuItemClickListener(onToolBarMenuItemClick);
}
Also used : Toolbar(android.support.v7.widget.Toolbar)

Aggregations

Toolbar (android.support.v7.widget.Toolbar)496 View (android.view.View)358 ActionBar (android.support.v7.app.ActionBar)178 TextView (android.widget.TextView)167 RecyclerView (android.support.v7.widget.RecyclerView)134 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)123 ImageView (android.widget.ImageView)84 Intent (android.content.Intent)75 ActionBarDrawerToggle (android.support.v7.app.ActionBarDrawerToggle)56 ArrayList (java.util.ArrayList)56 BindView (butterknife.BindView)46 AppCompatActivity (android.support.v7.app.AppCompatActivity)41 AdapterView (android.widget.AdapterView)41 NavigationView (android.support.design.widget.NavigationView)39 BarPainter (com.xabber.android.ui.color.BarPainter)36 MenuItem (android.view.MenuItem)35 FloatingActionButton (android.support.design.widget.FloatingActionButton)31 ViewPager (android.support.v4.view.ViewPager)31 ViewGroup (android.view.ViewGroup)31 Bundle (android.os.Bundle)29