Waz*_*_Be 11 android fullscreen toast
我按照教程重新尝试了自定义Toast:
http://developer.android.com/guide/topics/ui/notifiers/toasts.html#CustomToastView
有了这样的布局:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/toast_layout_root"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="8dp"
android:background="#DAAA"
>
<ImageView android:src="@drawable/droid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="8dp"
/>
<TextView android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FFF"
/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
但似乎根布局中的fill_parent无效.
您是否知道如何解决这个问题以获得全屏Toast?
yoa*_*oah 20
在显示Toast之前添加它:
toast.setGravity(Gravity.FILL, 0, 0);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4446 次 |
| 最近记录: |