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


Java Toast.getView方法代码示例

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


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

示例1: showToast

import android.widget.Toast; //导入方法依赖的package包/类
/**
 * {@link #tintDrawable(Drawable, ColorStateList)}
 * @param content content to show
 * @param longTime short or long
 * @param context context
 * @param textColor toast text color
 * @param toastBackgroundColor toast background color
 */
public static void showToast(@NonNull Context context, String content, boolean longTime,@ColorInt int toastBackgroundColor ,@ColorInt
        int textColor) {
    int type = longTime ? Toast.LENGTH_LONG : Toast.LENGTH_SHORT;
    Toast toast = Toast.makeText(context, content, type);
    View toastView = toast.getView();
    TextView textView = (TextView) toastView.findViewById(android.R.id.message);
    if (toastBackgroundColor != 0){
        Drawable toastBackgroundDrawable = tintDrawable(toastView.getBackground(), ColorStateList.valueOf(toastBackgroundColor));
        toastView.setBackgroundDrawable(toastBackgroundDrawable);
    }
    if (textColor!=0){
        textView.setTextColor(textColor);
    }
    toast.setView(toastView);
    toast.setText(content);
    toast.show();
}
 
开发者ID:didikee,项目名称:CommonDependence,代码行数:26,代码来源:UIToast.java

示例2: b

import android.widget.Toast; //导入方法依赖的package包/类
private void b(String str, int i) {
    Toast makeText = Toast.makeText(this, str, 1);
    LinearLayout linearLayout = (LinearLayout) makeText.getView();
    ((TextView) linearLayout.getChildAt(0)).setPadding(8, 0, 0, 0);
    View imageView = new ImageView(this);
    imageView.setLayoutParams(new LinearLayout.LayoutParams(a.a(this, 16.0f), a.a(this, 16.0f)));
    if (i == 0) {
        imageView.setImageDrawable(b("com.tencent.plus.ic_success.png"));
    } else {
        imageView.setImageDrawable(b("com.tencent.plus.ic_error.png"));
    }
    linearLayout.addView(imageView, 0);
    linearLayout.setOrientation(0);
    linearLayout.setGravity(17);
    makeText.setView(linearLayout);
    makeText.setGravity(17, 0, 0);
    makeText.show();
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:19,代码来源:ImageActivity.java

示例3: playByPlaylistId

import android.widget.Toast; //导入方法依赖的package包/类
public void playByPlaylistId(String str,int No){
	int count = playlistHandler.getPlaylistLength(Ui.ef.getBaseContext().getContentResolver(),No);
	if(count == 0 || count == -1){
		Toast toast = Toast.makeText(Gh.getBaseContext(), "Playlist is Empty.", Toast.LENGTH_SHORT);
		View view = toast.getView();
		view.setBackgroundColor(0xFFD35D69);
		toast.show();
		return;
	}
	resetDefault();
	list = playlistHandler.getPlaylistByIds(Gh.getContentResolver(),Integer.parseInt(str));
	if(list != null && list.size() != 0){
		PID = -1;
		if(list != null && list.size() > 0){
			AID =  Integer.parseInt( list.get(0)[1]) ;
		} else {
			AID = -1;
		}
	}

	playlist.listName = playlistHandler.getPlaylistNameById(Gh.getContentResolver(),Integer.parseInt(str));
	playlist.id = Integer.parseInt(str);
	playlist.save(list, playlist.listName);
	songPrepared = false;
	playByNumber(No);
	mEvent.trigger(playerEvents.PLAYLIST_CHANGED);
}
 
开发者ID:KishanV,项目名称:Android-Music-Player,代码行数:28,代码来源:musicHandler.java

示例4: getTextView

import android.widget.Toast; //导入方法依赖的package包/类
private static TextView getTextView(Toast toast) {
    LinearLayout layout = (LinearLayout) toast.getView();
    TextView tv = (TextView) layout.getChildAt(0);
    return tv;
}
 
开发者ID:qsyj,项目名称:ShortcutMenu,代码行数:6,代码来源:ToastUtil.java


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