當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。