From 8848e712cc4971a2c65314e8fdbc80035ea3bb82 Mon Sep 17 00:00:00 2001 From: seven332 Date: Tue, 10 Jun 2014 12:50:15 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=20SuperToast=20=E5=B8=83?= =?UTF-8?q?=E5=B1=80=EF=BC=8C=E4=BD=BF=E5=85=B6=E4=B8=8D=E4=BC=9A=E6=A8=AA?= =?UTF-8?q?=E5=90=91=E5=8D=A0=E6=BB=A1=E5=B1=8F=E5=B9=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- res/layout/super_toast.xml | 65 ++++++++++--------- src/com/hippo/ehviewer/widget/SuperToast.java | 6 +- 2 files changed, 40 insertions(+), 31 deletions(-) diff --git a/res/layout/super_toast.xml b/res/layout/super_toast.xml index 23e8e30f0..04f819c12 100644 --- a/res/layout/super_toast.xml +++ b/res/layout/super_toast.xml @@ -14,41 +14,48 @@ See the License for the specific language governing permissions and limitations under the License. --> - - - + + + + android:minHeight="60.0dp" + android:minWidth="100.0dp" + android:background="@color/toast_bg" > - - - + android:paddingStart="16dip" /> - + + + + + + + - \ No newline at end of file diff --git a/src/com/hippo/ehviewer/widget/SuperToast.java b/src/com/hippo/ehviewer/widget/SuperToast.java index 3408af156..7844a0a47 100644 --- a/src/com/hippo/ehviewer/widget/SuperToast.java +++ b/src/com/hippo/ehviewer/widget/SuperToast.java @@ -22,6 +22,7 @@ import android.content.Context; import android.graphics.drawable.Drawable; import android.view.LayoutInflater; import android.view.View; +import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; @@ -55,14 +56,15 @@ public class SuperToast extends Toast { private void init() { LayoutInflater inflate = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); - mMainView = (LinearLayout)inflate.inflate(R.layout.super_toast, null); + FrameLayout view = (FrameLayout)inflate.inflate(R.layout.super_toast, null); + mMainView = (LinearLayout)view.getChildAt(0); mIcon = (ImageView)mMainView.findViewById(R.id.icon); mMessage = (TextView)mMainView.findViewById(R.id.message); mIcon.setVisibility(View.GONE); setDuration(Toast.LENGTH_SHORT); - setView(mMainView); + setView(view); } public SuperToast setIcon(int resId) {