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


Java Snackbar.make方法代码示例

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


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

示例1: showSnackbar

import android.support.design.widget.Snackbar; //导入方法依赖的package包/类
public static Snackbar showSnackbar(View view, @StringRes int message,
                                    @StringRes int actionLabel,
                                    View.OnClickListener clickListener) {
    Snackbar snackbar = Snackbar.make(view, message, Snackbar.LENGTH_INDEFINITE);
    snackbar.setAction(actionLabel, clickListener);
    snackbar.show();
    return snackbar;
}
 
开发者ID:mobilemaster128,项目名称:quickblox-android,代码行数:9,代码来源:ErrorUtils.java

示例2: initSnackbarDatum

import android.support.design.widget.Snackbar; //导入方法依赖的package包/类
private void initSnackbarDatum() {
    snackbarDate = Snackbar.make(findViewById(R.id.snack), getContext().getString(R.string.snackbar_date_invalid), Snackbar.LENGTH_LONG);
    snackbarDate.setActionTextColor(ContextCompat.getColor(getContext(), R.color.colorPrimary));
    snackbarDate.setAction(getContext().getString(R.string.dismiss), new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            snackbarDate.dismiss();
        }
    });
}
 
开发者ID:LCA311,项目名称:leoapp-sources,代码行数:11,代码来源:KlausurDialog.java

示例3: getPermissionDeniedSnackbar

import android.support.design.widget.Snackbar; //导入方法依赖的package包/类
public static Snackbar getPermissionDeniedSnackbar(final View rootView) {
    Snackbar snackbar = Snackbar.make(rootView,
            R.string.read_permission_denied,
            Snackbar.LENGTH_INDEFINITE);
    snackbar.getView().setOnLongClickListener(new View.OnLongClickListener() {
        @Override
        public boolean onLongClick(View view) {
            Toast.makeText(rootView.getContext(), R.string.read_permission_denied, Toast.LENGTH_SHORT).show();
            return false;
        }
    });
    return snackbar;
}
 
开发者ID:kollerlukas,项目名称:Camera-Roll-Android-App,代码行数:14,代码来源:Util.java

示例4: EnforceRefresh

import android.support.design.widget.Snackbar; //导入方法依赖的package包/类
private void EnforceRefresh() {
    Snackbar snackbar = Snackbar.make(findViewById(R.id.MainContent), R.string.EnforceRef, Snackbar.LENGTH_INDEFINITE);
    snackbar.setAction(R.string.Refresh, new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            ((GlobalValues) getApplication()).matrixAdapter.notifyDataSetChanged();
        }
    });
    snackbar.show();
}
 
开发者ID:coder3101,项目名称:Matrix-Calculator-for-Android,代码行数:11,代码来源:MainActivity.java

示例5: createLoadingCompleteSnackbar

import android.support.design.widget.Snackbar; //导入方法依赖的package包/类
/**
 * 创建 加载完成... Snackbar
 *
 * @param view ViewGroup 子类
 */
public void createLoadingCompleteSnackbar(ViewGroup view) {
    Snackbar snackbar = Snackbar.make(view, "加载完成...", Snackbar.LENGTH_SHORT);
    Snackbar.SnackbarLayout snackBarLayout = (Snackbar.SnackbarLayout) snackbar.getView();
    snackBarLayout.setBackgroundColor(getColors(R.color.decoView_line1_start_color));
    snackBarLayout.setAlpha(0.9f);
    snackbar.show();
}
 
开发者ID:jpaijh,项目名称:TYT,代码行数:13,代码来源:BaseFragment.java

示例6: onProgress

import android.support.design.widget.Snackbar; //导入方法依赖的package包/类
@Override
public void onProgress(int current) {
    if (getActivity() != null) {
        snackbar = Snackbar.make(getActivity().findViewById(R.id.fab), R.string.frag_station_conn_info_loading, Snackbar.LENGTH_INDEFINITE);
        snackbar.show();
    }
}
 
开发者ID:gbl08ma,项目名称:underlx,代码行数:8,代码来源:StationGeneralFragment.java

示例7: showSnackbar

import android.support.design.widget.Snackbar; //导入方法依赖的package包/类
public static void showSnackbar(View container, @NonNull SnackbarType snackbarType,
                                @StringRes int textStringRes, @Nullable SnackbarDuration duration,
                                @Nullable BaseTransientBottomBar.BaseCallback<Snackbar> callback) {

    duration = (duration == null ? SnackbarDuration.LONG : duration);

    Snackbar snackbar = Snackbar.make(container, textStringRes, duration.getDuration());
    snackbar.getView().setBackgroundResource(snackbarType.getColorRes());
    TextView snackbarText = (TextView) snackbar.getView().findViewById(android.support.design.R.id.snackbar_text);
    snackbarText.setCompoundDrawablesWithIntrinsicBounds(0, 0,snackbarType.getIconRes(), 0);
    snackbarText.setGravity(Gravity.CENTER);
    if(callback != null)
        snackbar.addCallback(callback);
    snackbar.show();
}
 
开发者ID:abicelis,项目名称:Remindy,代码行数:16,代码来源:SnackbarUtil.java

示例8: showSnackBar

import android.support.design.widget.Snackbar; //导入方法依赖的package包/类
private void showSnackBar(String message) {
    Snackbar snackbar = Snackbar.make(findViewById(android.R.id.content),
            message, Snackbar.LENGTH_SHORT);
    View sbView = snackbar.getView();
    TextView textView = (TextView) sbView
            .findViewById(android.support.design.R.id.snackbar_text);
    textView.setTextColor(ContextCompat.getColor(this, R.color.white));
    snackbar.show();
}
 
开发者ID:MindorksOpenSource,项目名称:android-mvp-architecture,代码行数:10,代码来源:BaseActivity.java

示例9: displaySnackBar

import android.support.design.widget.Snackbar; //导入方法依赖的package包/类
/**
 * function to display snackbar in app screen
 * Used during no network connection
 */
private void displaySnackBar(){
    Snackbar snackbar = Snackbar.make(findViewById(R.id.activity_main),
            getString(R.string.no_network), Snackbar.LENGTH_SHORT);
    snackbar.setAction(R.string.setting_text, new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(android.provider.Settings.ACTION_WIFI_SETTINGS);
            startActivity(intent);
        }
    });
    snackbar.show();
}
 
开发者ID:Joesmithessang,项目名称:ALC-Project,代码行数:17,代码来源:MainActivity.java

示例10: onActivityResult

import android.support.design.widget.Snackbar; //导入方法依赖的package包/类
@Override
protected void onActivityResult(int request, int result, Intent data) {
	super.onActivityResult(request, result, data);

	if (request == REQUEST_INTRODUCTION && result == RESULT_OK) {
		Snackbar snackbar = Snackbar.make(list, R.string.introduction_sent,
				Snackbar.LENGTH_SHORT);
		snackbar.getView().setBackgroundResource(R.color.briar_primary);
		snackbar.show();
	}
}
 
开发者ID:rafjordao,项目名称:Nird2,代码行数:12,代码来源:ConversationActivity.java

示例11: onSharedPreferenceChanged

import android.support.design.widget.Snackbar; //导入方法依赖的package包/类
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
    if (key == getString(R.string.pref_master_is_local_key) ||
            key == getString(R.string.pref_master_uri_key)) {

        if (settingsWereAppliedThisSession() && mSettingsPreferenceFragment.getView() != null) {
            Snackbar snackbar = Snackbar.make(mSettingsPreferenceFragment.getView(),
                    getString(R.string.snackbar_text_restart), Snackbar.LENGTH_INDEFINITE);
            View snackBarView = snackbar.getView();
            snackBarView.setBackgroundColor(getResources().getColor(android.R.color.holo_orange_dark));
            snackbar.show();
        }
    }
}
 
开发者ID:ekumenlabs,项目名称:tangobot,代码行数:15,代码来源:SettingsActivity.java

示例12: showSnackbar3

import android.support.design.widget.Snackbar; //导入方法依赖的package包/类
private void showSnackbar3() {
    final Snackbar cS = Snackbar.make(Utils.getController().getProfileActivity().getCoordinatorLayout(), R.string.error, Snackbar.LENGTH_LONG);
    cS.setActionTextColor(Color.WHITE);
    cS.setAction(Utils.getString(R.string.snackbar_no_connection_button), new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            cS.dismiss();
        }
    });
    cS.show();
}
 
开发者ID:LCA311,项目名称:leoapp-sources,代码行数:12,代码来源:UpdateNameTask.java

示例13: showRetrySnackBar

import android.support.design.widget.Snackbar; //导入方法依赖的package包/类
public static void showRetrySnackBar(Activity activity, String text, View.OnClickListener listener){
    Snackbar snackbar = Snackbar.make(activity.findViewById(R.id.content_view), text, Snackbar.LENGTH_INDEFINITE);
    if (null != listener) {
        snackbar.setAction("RETRY", listener)
                .setActionTextColor(SettingsActivity.getPrimaryColor(activity));
    }
    snackbar.show();
}
 
开发者ID:kranthi0987,项目名称:easyfilemanager,代码行数:9,代码来源:Utils.java

示例14: showPermissionMessage

import android.support.design.widget.Snackbar; //导入方法依赖的package包/类
@Override
public void showPermissionMessage(int resId) {
    final Snackbar snackbar = Snackbar.make(rlRoot, resId, Snackbar.LENGTH_INDEFINITE);
    snackbar.setAction(R.string.button_settings, new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            presenter.showAppSystemSettings();
            snackbar.dismiss();
        }
    });
    snackbar.show();
}
 
开发者ID:vshkl,项目名称:PXLSRT,代码行数:13,代码来源:CameraActivity.java

示例15: requestLocationServices

import android.support.design.widget.Snackbar; //导入方法依赖的package包/类
private void requestLocationServices() {
    Snackbar snackbar = Snackbar.make(
            coordinatorLayout,
            R.string.error_location_disabled,
            Snackbar.LENGTH_INDEFINITE
    );
    snackbar.setAction(R.string.action_enable, new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            AndroidLocationProvider.requestLocationEnabling(HomeActivity.this);
        }
    });
    snackbar.show();
}
 
开发者ID:neXenio,项目名称:BLE-Indoor-Positioning,代码行数:15,代码来源:HomeActivity.java


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