Issue
I cant seem to find what is wrong with my program with this error please
My code is long for me to post all my R. got red highlighted after i included this
LayoutInflater inflater = getLayoutInflater();
View layout = inflater.inflate(R.layout.toast_layout,
(ViewGroup) findViewById(R.id.toast_layout_root));
TextView text = (TextView) layout.findViewById(R.id.text);
text.setText("Please select a Level!");
text.setTextColor(Color.BLUE);
text.setTextSize(15);
Toast toast = new Toast(getApplicationContext());
toast.setGravity(Gravity.CENTER, 0, 0);
toast.setDuration(Toast.LENGTH_SHORT);
// toast.getView().setBackgroundColor(Color.BLUE);
toast.setView(layout);
toast.show();
<?xml version="1.0" encoding="utf-8"?>
<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>
help
Solution
Things to check
- Check if you image.jpg and image.png both in drawable folders.
if this is not case
- Perform Build > Clean Project
if still not resolved issue
- File > Invalidate Cache And Restart
Answered By - Kirtan
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.