Hi In don't understand why I get this error, Parent view is not a TextView Any help would be appreciated. I have tried a few things but none seem to work.
LayoutInflater inflater = getLayoutInflater();
View layout = inflater.inflate(R.layout.custom_toast_screen_pass, (ViewGroup)findViewById(R.id.layout_pass));
Toast toast = new Toast(getApplicationContext());
toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
toast.setDuration(Toast.LENGTH_SHORT);
toast.setView(layout);
toast.show();
<ImageView
android:id="@+id/approval_icn"
android:layout_height="40dp"
android:layout_width="40dp"
android:src="@drawable/approval_icon"
android:layout_gravity="center_vertical" >
</ImageView>
<TextView
android:id="@+id/pass_txt"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:textColor="#FFFFFF"
android:textSize="20sp"
android:text="Congratulations you have passed the quiz" >
</TextView>
</LinearLayout>
0 comments:
Post a Comment