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) {