I have a UI design for an application. As we know that there are two view while designing a UI for an app in android in eclipse one the xml view and other the graphical layout. i am having a problem that i cannot get graphical layout of my xml. it sh开发者_运维问答ows a null pointer exception when i switch to graphical layout. Any suggestions..?
I think you might find that the View.isInEditMode()
function is what you are looking for.
Use it on any view that you have a reference to in the Activity
.
If it returns true, don't attempt to get the reference that you were trying to get.
It's a little hard to tell if this will fix it for you, but you should definitely try this.
i think you are using some custom drawable(ie either shapes or style). it is not shown at design time but you will able to see when you run the project
精彩评论