开发者

two of my Graphical Layout components are missing

开发者 https://www.devze.com 2023-02-19 21:28 出处:网络
I\'ve recently started Eclipse and Android programming and I notices that alot of my Visual Components are missing their classes.

I've recently started Eclipse and Android programming and I notices that alot of my Visual Components are missing their classes.

Such as the Sliding Tab (which I need for my UI) which only gives me this message when placed:

error! ClassCastException: com.android.layoutlib.bridge.MockView cannot be cast to android.view.ViewGroup Exception details are logged in Window > Show View > Error LogTh开发者_运维知识库e following classes could not be found: - SlidingDrawer

And with the Tabhost & TabWidget:

Error during post inflation process: TabHost requires a TabWidget with id "android:id/tabs". View found with id 'tabs' is 'com.android.layoutlib.bridge.MockView' The following classes could not be found: - TabWidget


Answers would be much appreciated


This seems like a bug in the Layout Editor:
http://code.google.com/p/android/issues/detail?id=2021

I have the same issue, and only way you can do tabs, is to write it in xml. Hope it gets fixed soon.


I had the same problem as in the original Question, I think. At least the problem with "TabHost" and "TabWidget". Not even copy-paste out of this tutorial works! http://developer.android.com/resources/tutorials/views/hello-tabwidget.html

But I now found a tutorial with sourcecode that actually works. Don't know why though at the moment. Just try it. http://www.androidpeople.com/android-tabhost-tutorial-part-1/

There is another thing that I noticed. If I change the target plattform to Android 3.0 the graphical layout designer works without problems!


There are ongoing improvements in the rendering libraries for the graphical editor.

See this issue for details: http://code.google.com/p/android/issues/detail?id=2021

Buried in there is a reference to the workarounds:

  • Switch your platform for the graphical editor to a higher one, or
  • Update to the latest ADT (r12 as of this writing) and install the preview rendering libraries. This approach is detailed at the tools site: http://tools.android.com/download

The latter solution resolved the problems for me with the TabWidget. Hopefully all will be integrated by r13 of the tools and the preview libraries won't be needed.

0

精彩评论

暂无评论...
验证码 换一张
取 消