package com.example.mytoast;
import android.content.Context;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.view.WindowManager;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
public class CustomToast extends Toast {
static Toast toast;
public CustomToast(Context context) {
// TODO Auto-generated constructor stub
super(context);
}
public static Toast makeText(Context context, CharSequence text,
int duration) {
toast = new Toast(context);
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
WindowManager wm = (WindowManager) context
.getSystemService(Context.WINDOW_SERVICE);
int width = wm.getDefaultDisplay().getWidth() - 100;
View view = inflater.inflate(R.layout.toast_layout, null);
TextView textView = (TextView) view.findViewById(R.id.textview1);
textView.setText(text);
toast.setView(view);
toast.setGravity(Gravity.TOP, 0, 30);
toast.setDuration(duration);
return toast;
}
public void show() {
toast.show();
}
}
资源文件列表
Mytoast/.classpath , 475
Mytoast/.project , 843
Mytoast/.settings/org.eclipse.jdt.core.prefs , 177
Mytoast/AndroidManifest.xml , 862
Mytoast/bin/AndroidManifest.xml , 862
Mytoast/bin/Mytoast.apk , 474049
Mytoast/bin/classes/com/example/mytoast/BuildConfig.class , 347
Mytoast/bin/classes/com/example/mytoast/CustomToast.class , 1745
Mytoast/bin/classes/com/example/mytoast/MainActivity$1.class , 1093
Mytoast/bin/classes/com/example/mytoast/MainActivity.class , 972
Mytoast/bin/classes/com/example/mytoast/Mytoast.class , 1499
Mytoast/bin/classes/com/example/mytoast/R$attr.class , 343
Mytoast/bin/classes/com/example/mytoast/R$dimen.class , 464
Mytoast/bin/classes/com/example/mytoast/R$drawable.class , 503
Mytoast/bin/classes/com/example/mytoast/R$id.class , 495
Mytoast/bin/classes/com/example/mytoast/R$layout.class , 442
Mytoast/bin/classes/com/example/mytoast/R$menu.class , 391
Mytoast/bin/classes/com/example/mytoast/R$string.class , 475
Mytoast/bin/classes/com/example/mytoast/R$style.class , 434
Mytoast/bin/classes/com/example/mytoast/R.class , 683
Mytoast/bin/classes.dex , 1378676
Mytoast/bin/dexedLibs/android-support-v4-918991531d48d82d532a5d525574d930.jar , 455936
Mytoast/bin/jarlist.cache , 120
Mytoast/bin/res/crunch/drawable-hdpi/ic_launcher.png , 1541
Mytoast/bin/res/crunch/drawable-hdpi/test2.png , 1041
Mytoast/bin/res/crunch/drawable-hdpi/testla.png , 1681
Mytoast/bin/res/crunch/drawable-mdpi/ic_launcher.png , 1069
Mytoast/bin/res/crunch/drawable-xhdpi/ic_launcher.png , 1889
Mytoast/bin/res/crunch/drawable-xxhdpi/ic_launcher.png , 2543
Mytoast/bin/resources.ap_ , 16516
Mytoast/gen/com/example/mytoast/BuildConfig.java , 161
Mytoast/gen/com/example/mytoast/R.java , 2982
Mytoast/ic_launcher-web.png , 14212
Mytoast/libs/android-support-v4.jar , 1364299
Mytoast/proguard-project.txt , 781
Mytoast/project.properties , 563
Mytoast/res/drawable-hdpi/background.xml , 863
Mytoast/res/drawable-hdpi/ic_launcher.png , 1416
Mytoast/res/drawable-hdpi/test2.png , 1118
Mytoast/res/drawable-hdpi/testla.png , 1921
Mytoast/res/drawable-mdpi/ic_launcher.png , 882
Mytoast/res/drawable-xhdpi/ic_launcher.png , 1810
Mytoast/res/drawable-xxhdpi/ic_launcher.png , 2738
Mytoast/res/layout/activity_main.xml , 799
Mytoast/res/layout/toast_layout.xml , 1203
Mytoast/res/menu/main.xml , 369
Mytoast/res/values/dimens.xml , 220
Mytoast/res/values/strings.xml , 224
Mytoast/res/values/styles.xml , 697
Mytoast/res/values-v11/styles.xml , 334
Mytoast/res/values-v14/styles.xml , 391
Mytoast/res/values-w820dp/dimens.xml , 381
Mytoast/src/com/example/mytoast/CustomToast.java , 1258
Mytoast/src/com/example/mytoast/MainActivity.java , 1051
Mytoast/src/com/example/mytoast/Mytoast.java , 944
