Reputation: 27
I tried to set a full screen background for my main layout in android studio 2.3.3.
But the problem is even when I convert my image for all the dpi's but stay cant see my image in my background i use (android:background="Drawble/bg-main" ) not working i use ImageView to set it but its not working and show this error (failed to instantiate one or more class)
I don't know what to do and I am very newbie in android developing thanks for helping me see my screen shot to understand completely
Screen Shot Error 1:
Screen Shot Error 2:
Upvotes: 0
Views: 132
Reputation: 11
Because drawable name Bg-Main its not acceptable..
you r using bg_main special character not allow(B,-)
Upvotes: 1
Reputation: 2708
'-' is not a valid file-based resource name character:
File-based resource names must contain only lowercase a-z, 0-9, or underscore
Change your image name as bg_main for all. It will do.
Upvotes: 1
Reputation: 790
You cannot use capital letters or -
in drawable image name. Just try to rename your image as bg_main and your problem will be solved.
Upvotes: 3
Reputation: 759
Use _
instead of -
. So, your drawable should look like this bg_main
/
P.S: never use -
in XML naming
Upvotes: 2