问题描述
这是我得到的我的布局XML文件中的错误:
This is the error I'm getting in my layout XML files:
Exception raised during rendering: 0
Exception details are logged in Window > Show View > Error Log
The following classes could not be found:
- View (Change to android.view.View, Fix Build Path, Edit XML)
我的XML文件:
My Xml File is :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/list_view_main_lin_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#00FFFFFF"
android:orientation="vertical" >
<ViewFlipper
android:id="@+id/search_view_flipper"
android:layout_width="fill_parent"
android:visibility="gone"
android:layout_height="@dimen/list_view_row_size" >
<LinearLayout
android:id="@+id/search_lin_layout"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:gravity="center_vertical" >
<TextView
android:id="@+id/search_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:drawableLeft="@drawable/search_ico"
android:drawablePadding="10dp"
android:gravity="center_vertical"
android:text="@string/search_text_view"
android:textColor="#FF37200e"
android:textSize="@dimen/text_view_left_menu" />
</LinearLayout>
<RelativeLayout
android:id="@+id/search_edit_text_relative_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<EditText
android:id="@+id/search_edit_text"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:background="@drawable/rounded_edittext"
android:drawableLeft="@drawable/searchgray_ico"
android:drawablePadding="05dp"
android:textCursorDrawable="@null"
android:hint="@string/search_text_view"
android:imeOptions="actionDone"
android:paddingLeft="10dp"
android:paddingRight="35dp"
android:singleLine="true"
android:textSize="@dimen/text_view_left_menu"
android:textColor="#000000" />
<ImageButton
android:id="@+id/cancel_search_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="@+id/search_edit_text"
android:layout_centerVertical="true"
android:layout_marginRight="2dp"
android:src="@drawable/cross"
android:background="#00000000"
android:padding="10dp" />
</RelativeLayout>
</ViewFlipper>
<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="@drawable/listview_divider" />
<LinearLayout
android:id="@+id/featured_lin_layout"
android:layout_width="match_parent"
android:layout_height="@dimen/list_view_row_size"
android:gravity="center_vertical" >
<TextView
android:id="@+id/featured_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="@string/featured_text_view"
android:textColor="#FF37200e"
android:textSize="@dimen/text_view_left_menu" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:contentDescription="@string/featured_text_view"
android:src="@drawable/featured_ico" />
</LinearLayout>
<View
android:id="@+id/view_featured_divider"
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="@drawable/listview_divider" />
<LinearLayout
android:id="@+id/favorites_lin_layout"
android:layout_width="match_parent"
android:layout_height="@dimen/list_view_row_size"
android:gravity="center_vertical" >
<TextView
android:id="@+id/favorites_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="@string/favorites_text_view"
android:textColor="#FFb2661A"
android:textSize="@dimen/text_view_left_menu" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:contentDescription="@string/favorites_text_view"
android:src="@drawable/favorites_active_ico" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="@drawable/listview_divider" />
<ListView
android:id="@+id/main_list_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:divider="@android:color/transparent"
android:smoothScrollbar="true"
android:cacheColorHint="#00000000"
android:dividerHeight="0dp"
android:fadingEdge="none"
android:scrollbars="none" >
</ListView>
我使用Eclipse的朱诺。目前我的项目构建目标为的Android 4.1 。我也通过降低API级别尝试,但它并不能帮助我。
I'm using Eclipse Juno. Currently my project Build target is android 4.1. I've tried by lowering the API level also but it doesn't help me.
由于这个我不能看到我的XML文件的图形布局。
请人帮助我。
Due to this I'm not able to see the graphical layout of my XML files.Please anybody help me.
推荐答案
有是你的目标SDK版本和图形化布局的目标之间的不匹配,应该是一个容易解决。
There is a mismatch between your target SDK version and your Graphical Layout target, should be an easy fix.
如果你不知道它关闭你的头顶,你可以得到你的Android SDK版本从您的项目名称右键单击你的项目,去属性,选择Android的,并寻找测试在带有复选标记该行的平台专栏。
If you don't know it off the top of your head, you can get your Android SDK version for your project from right-clicking on your project name, going to Properties, selecting "Android", and looking for the test in the "platform" column for the row with a checkmark.
然后在图形布局XML文件,在场景选择和创建按钮的右上方是Android版本下拉。更改此相匹配的一个项目,而错误应该走的图形preVIEW将呈现正确。
Then in the Graphical Layout for your XML file, in the top right in between the Locale selector and the Create button is a drop-down for Android versions. Change this to match the one for your project, and the errors should go away the graphical preview will render correctly.
这篇关于在Eclipse XML错误而查看XML的图形化布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!