Activity:
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android"Xmlns:tools="Http://schemas.android.com/tools"Android:layout_width="match_parent"Android:layout_height="match_parent"Android:paddingbottom="@dimen/activity_vertical_margin"Android:paddingleft="@dimen/activity_horizontal_margin"Android:paddingright="@dimen/activity_horizontal_margin"Android:paddingtop="@dimen/activity_vertical_margin"Tools:context="com.example.top4.MainActivity"> <TextView android:layout_width="wrap_content"Android:layout_height="wrap_content"Android:text="@string/hello_world"/></relativelayout>
Java:
View view=getlayoutinflater (). Inflate (R.layout.activity_main,NULL); //Define a toastToast ts=NewToast ( This); //output The Tosat to the ViewTs.setview (view); //Set toast TimeTs.setduration ( -); //Setting the location of the TostTs.setgravity (gravity.bottom| Gravity.right, -, -); //Finally, remember to add. Show ();Ts.show ();
Use of Android Basic Top4:tost