当前位置: 首页>>代码示例>>Java>>正文


Java ActionBar.setBackgroundDrawable方法代码示例

本文整理汇总了Java中android.support.v7.app.ActionBar.setBackgroundDrawable方法的典型用法代码示例。如果您正苦于以下问题:Java ActionBar.setBackgroundDrawable方法的具体用法?Java ActionBar.setBackgroundDrawable怎么用?Java ActionBar.setBackgroundDrawable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.v7.app.ActionBar的用法示例。


在下文中一共展示了ActionBar.setBackgroundDrawable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initView

import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
private void initView() {
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setBackgroundDrawable(new ColorDrawable(ContextCompat.getColor(mContext, R.color.color_Actionbar)));
    }
    mCoordinatorLayout = findViewById(R.id.coordinator);

    RecyclerView recyclerView = findViewById(R.id.recycle_view);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    mAdapter = new LocationAdapter(this, new ArrayList<Location>());
    @SuppressWarnings("unchecked") SwingBottomInAnimationAdapter animatorAdapter = new SwingBottomInAnimationAdapter(mAdapter, recyclerView);
    recyclerView.setAdapter(animatorAdapter);

    ItemTouchHelper.Callback callback = new ItemTouchHelperCallBackNoMove(mAdapter);
    ItemTouchHelper touchHelper = new ItemTouchHelper(callback);
    touchHelper.attachToRecyclerView(recyclerView);

    mView_FABMenu = findViewById(R.id.fab_menu_1);
    FloatingActionButton addLocation = findViewById(R.id.fab_action_1);
    addLocation.setVisibility(View.VISIBLE);
    addLocation.setLabelText(mContext.getResources().getString(R.string.add_location));
    addLocation.setOnClickListener(this);
}
 
开发者ID:nhocga1995s,项目名称:MyCalendar,代码行数:25,代码来源:LocationListActivity.java

示例2: initView

import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
private void initView() {
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setBackgroundDrawable(new ColorDrawable(ContextCompat.getColor(mContext, R.color.color_Actionbar)));
    }
    mCoordinatorLayout = findViewById(R.id.coordinator);

    RecyclerView recyclerView = findViewById(R.id.recycle_view);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    RecyclerView.ItemAnimator animator = recyclerView.getItemAnimator();
    if (animator instanceof DefaultItemAnimator) {
        ((DefaultItemAnimator) animator).setSupportsChangeAnimations(false);
    }
    mAdapter = new CancelAdapter(this, new ArrayList<DayLesson>());
    @SuppressWarnings("unchecked") SwingBottomInAnimationAdapter animatorAdapter = new SwingBottomInAnimationAdapter(mAdapter, recyclerView);
    recyclerView.setAdapter(animatorAdapter);

    ItemTouchHelper.Callback callback = new ItemTouchHelperCallBackNoMove(mAdapter);
    ItemTouchHelper touchHelper = new ItemTouchHelper(callback);
    touchHelper.attachToRecyclerView(recyclerView);

    mView_FABMenu = findViewById(R.id.fab_menu_1);
    mView_FABMenu.setVisibility(View.GONE);
}
 
开发者ID:nhocga1995s,项目名称:MyCalendar,代码行数:26,代码来源:CancelListActivity.java

示例3: initView

import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
private void initView() {

        ActionBar actionBar = getSupportActionBar();
        if (actionBar != null) {
            actionBar.setDisplayHomeAsUpEnabled(true);
            actionBar.setBackgroundDrawable(new ColorDrawable(ContextCompat.getColor(mContext, R.color.color_Actionbar)));
        }
        mCoordinatorLayout = findViewById(R.id.coordinator);

        RecyclerView recyclerView = findViewById(R.id.recycle_view);
        recyclerView.setLayoutManager(new LinearLayoutManager(this));
        mAdapter = new TeacherAdapter(this, new ArrayList<Teacher>());
        @SuppressWarnings("unchecked") SwingBottomInAnimationAdapter animatorAdapter = new SwingBottomInAnimationAdapter(mAdapter, recyclerView);
        recyclerView.setAdapter(animatorAdapter);

        ItemTouchHelper.Callback callback = new ItemTouchHelperCallBackNoMove(mAdapter);
        ItemTouchHelper touchHelper = new ItemTouchHelper(callback);
        touchHelper.attachToRecyclerView(recyclerView);

        mView_FABMenu = findViewById(R.id.fab_menu_1);
        FloatingActionButton addTeacher = findViewById(R.id.fab_action_1);
        addTeacher.setVisibility(View.VISIBLE);
        addTeacher.setLabelText(mContext.getResources().getString(R.string.add_teacher));
        addTeacher.setOnClickListener(this);

        CoordinatorLayout.LayoutParams params =
                (CoordinatorLayout.LayoutParams) mView_FABMenu.getLayoutParams();
        params.setBehavior(new FloatingActionMenuBehavior());
        mView_FABMenu.requestLayout();

    }
 
开发者ID:nhocga1995s,项目名称:MyCalendar,代码行数:32,代码来源:TeacherListActivity.java

示例4: initView

import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
private void initView() {
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setBackgroundDrawable(new ColorDrawable(ContextCompat.getColor(mContext, R.color.color_Actionbar)));
    }

    mView_Coordinator = findViewById(R.id.coordinator);
    mView_SubjectName = findViewById(R.id.week_lesson_detail_subject_name);
    mView_SubjectArrow = findViewById(R.id.arrow);
    mView_Weekday = findViewById(R.id.week_lesson_detail_weekday);
    mView_Repeat = findViewById(R.id.week_lesson_detail_repeat);
    mView_Day = findViewById(R.id.week_lesson_detail_day);
    mView_FABMenu = findViewById(R.id.fab_menu_1);
    FloatingActionButton addDayLesson = findViewById(R.id.fab_action_1);
    FloatingActionButton editWeekLesson = findViewById(R.id.fab_action_2);
    addDayLesson.setVisibility(View.VISIBLE);
    editWeekLesson.setVisibility(View.VISIBLE);
    addDayLesson.setLabelText(mResources.getString(R.string.add_day_lesson));
    editWeekLesson.setLabelText(mResources.getString(R.string.edit_week_lesson));
    editWeekLesson.setImageResource(R.drawable.ic_edit_white_24dp);

    RecyclerView mView_RecyclerView = findViewById(R.id.recycle_view);
    mView_RecyclerView.setNestedScrollingEnabled(false);
    mView_RecyclerView.setLayoutManager(new LinearLayoutManager(this));
    mAdapter = new DayLessonAdapter(mContext, new ArrayList<DayLesson>(), mColorText, mColorBackground);
    @SuppressWarnings("unchecked") SwingBottomInAnimationAdapter animatorAdapter = new SwingBottomInAnimationAdapter(mAdapter, mView_RecyclerView);
    mView_RecyclerView.setAdapter(animatorAdapter);

    ItemTouchHelper.Callback callback = new ItemTouchHelperCallBackNoMove(mAdapter);
    ItemTouchHelper touchHelper = new ItemTouchHelper(callback);
    touchHelper.attachToRecyclerView(mView_RecyclerView);

    registerForContextMenu(mView_SubjectArrow);
    mView_SubjectArrow.setOnClickListener(this);
    mView_SubjectName.setOnClickListener(this);
    addDayLesson.setOnClickListener(this);
    editWeekLesson.setOnClickListener(this);
    setUpInfo();
}
 
开发者ID:nhocga1995s,项目名称:MyCalendar,代码行数:41,代码来源:WeekLessonDetailActivity.java

示例5: setupActionBar

import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
/**
 * Set up the {@link android.app.ActionBar}, if the API is available.
 */
private void setupActionBar() {
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        // Show the Up button in the action bar.
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setBackgroundDrawable(new ColorDrawable(ContextCompat.getColor(this, R.color.color_Actionbar)));
    }
}
 
开发者ID:nhocga1995s,项目名称:MyCalendar,代码行数:12,代码来源:SettingsActivity.java

示例6: applyNewColor

import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
private void applyNewColor (String actionBarColor, String tabStripColor, String indicatorColor) {
    ActionBar actionBar = getSupportActionBar();
    Window window = this.getWindow();

    actionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor(actionBarColor)));
    window.setStatusBarColor(Color.parseColor(indicatorColor));
    tabStrip.setBackground(new ColorDrawable((Color.parseColor(tabStripColor))));
    tabStrip.setIndicatorColor(Color.parseColor(indicatorColor));
    actionButton.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor(actionBarColor)));

}
 
开发者ID:LewisVo,项目名称:Minitask,代码行数:12,代码来源:MainActivity.java

示例7: setActionBar

import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
public void setActionBar() {
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        mToolbar.setNavigationOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                onBackPressed();
            }
        });
        actionBar.setTitle(R.string.course_detail_title);
        actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.dark_green)));
    }
    setStatusBarColor(getResources().getColor(R.color.dark_green));
}
 
开发者ID:kamisakihideyoshi,项目名称:TaipeiTechRefined,代码行数:16,代码来源:CourseDetailActivity.java

示例8: setActionBarColor

import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
public static void setActionBarColor(AppCompatActivity activity, int mAppBarColor)
{
    if (mSharedPreferences == null)
    {
        mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(activity);
    }

    if (activity != null)
    {
        ActionBar actionBar = activity.getSupportActionBar();

        if (actionBar != null)
        {
            actionBar.setBackgroundDrawable(new ColorDrawable(mAppBarColor));

            //Change status bar color too
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
            {
                Window window = activity.getWindow();

                // clear FLAG_TRANSLUCENT_STATUS flag:
                window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);

                // add FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS flag to the window
                window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
                window.setStatusBarColor(HueUtils.darkenColor(mAppBarColor, 0.7f));
            }
        }
    }
}
 
开发者ID:HueToYou,项目名称:ChatExchange-old,代码行数:31,代码来源:ActionBarHue.java

示例9: setActionBarColorToSharedPrefsValue

import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
public static void setActionBarColorToSharedPrefsValue(AppCompatActivity activity)
{
    if (mSharedPreferences == null)
    {
        mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(activity);
    }

    if (activity != null)
    {
        ActionBar actionBar = activity.getSupportActionBar();

        if (actionBar != null)
        {
            int initialColor = mSharedPreferences.getInt("default_color", activity.getResources().getColor(R.color.colorPrimary));
            actionBar.setBackgroundDrawable(new ColorDrawable(initialColor));

            //Change status bar color too
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
            {
                Window window = activity.getWindow();

                // clear FLAG_TRANSLUCENT_STATUS flag:
                window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);

                // add FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS flag to the window
                window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
                window.setStatusBarColor(HueUtils.darkenColor(initialColor, 0.7f));
            }

        }
    }
}
 
开发者ID:HueToYou,项目名称:ChatExchange-old,代码行数:33,代码来源:ActionBarHue.java

示例10: setActionBar

import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
public void setActionBar() {
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setTitle(currentFragment.getTitleStringId());
        actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(currentFragment.getTitleColorId())));
    }
    setStatusBarColor(getResources().getColor(currentFragment.getTitleColorId()));
}
 
开发者ID:kamisakihideyoshi,项目名称:TaipeiTechRefined,代码行数:9,代码来源:MainActivity.java

示例11: setActionBar

import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
public void setActionBar() {
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        mToolbar.setNavigationOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        actionBar.setTitle(R.string.donate_text);
        actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.deep_darken)));
    }
    Utility.setStatusBarColor(this, getResources().getColor(R.color.deep_darken));
}
 
开发者ID:kamisakihideyoshi,项目名称:TaipeiTechRefined,代码行数:16,代码来源:DonateActivity.java

示例12: setupActionBar

import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
private void setupActionBar() {
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        // Show the Up button in the action bar.
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(PIBLUE)));
    }
}
 
开发者ID:privacyidea,项目名称:privacyidea-authenticator,代码行数:9,代码来源:AboutActivity.java

示例13: setupActionBar

import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
private void setupActionBar() {
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        // Show the Back button in the action bar.
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(PIBLUE)));
    }
}
 
开发者ID:privacyidea,项目名称:privacyidea-authenticator,代码行数:9,代码来源:EnterDetailsActivity.java

示例14: changeAppbarColor

import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
public static void changeAppbarColor(Activity activity, @ColorRes int id) {
    ActionBar actionBar = ((AppCompatActivity) activity).getSupportActionBar();
    if (actionBar != null) actionBar.setBackgroundDrawable(new ColorDrawable(activity.getResources().getColor(id)));
}
 
开发者ID:djuelg,项目名称:Neuronizer,代码行数:5,代码来源:AppbarCustomizer.java

示例15: setToolbarColor

import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
public static void setToolbarColor(AppCompatActivity activity, int color){
    ActionBar actionBar=activity.getSupportActionBar();
    actionBar.setBackgroundDrawable(new ColorDrawable(color));
}
 
开发者ID:ifadai,项目名称:AndroidThemeChange,代码行数:5,代码来源:ThemeUtils.java


注:本文中的android.support.v7.app.ActionBar.setBackgroundDrawable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。