Android 无法呈现XML
我正在试着使用这个工具。而DemoApp编译并运行良好。它不会呈现XML 以下是呈现时XML显示的异常: 活动\u demo.xmlAndroid 无法呈现XML,android,xml,android-layout,android-xml,Android,Xml,Android Layout,Android Xml,我正在试着使用这个工具。而DemoApp编译并运行良好。它不会呈现XML 以下是呈现时XML显示的异常: 活动\u demo.xml <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".DemoActivity" > <com.sothree.slidinguppanel.dem
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".DemoActivity" >
<com.sothree.slidinguppanel.demo.SlidingUpPanelLayout
xmlns:sothree="http://schemas.android.com/apk/res-auto"
android:id="@+id/sliding_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom"
sothree:dragView="@+id/name"
sothree:panelHeight="68dp"
sothree:paralaxOffset="100dp"
sothree:shadowHeight="4dp" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="?android:attr/actionBarSize" >
<TextView
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
android:focusable="false"
android:focusableInTouchMode="true"
android:gravity="center"
android:text="Main Content"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#eeeeee"
android:clickable="true"
android:focusable="false"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="68dp"
android:orientation="horizontal" >
<TextView
android:id="@+id/name"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:paddingLeft="10dp"
android:textSize="14sp" />
<Button
android:id="@+id/follow"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical|right"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:textSize="14sp" />
</LinearLayout>
<ImageView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:scaleType="fitStart"
android:src="@drawable/graphic" >
</ImageView>
</LinearLayout>
</com.sothree.slidinguppanel.demo.SlidingUpPanelLayout>
</RelativeLayout>
自定义
视图
通常不会在Eclipse或IntelliJ的UI编辑器中呈现。这不是悲剧
但是,堆栈跟踪建议,如果自定义的视图刚刚显示在UI编辑器中,则应使用视图.isInEditMode()
跳过渲染
您只需添加以下内容:
if(isInEditMode()){
return;
}
如果您使用的是库的本地副本,则在自定义视图中的第行之后。或者只是向Github上的回购协议发送一个请求,这就增加了这一点 1)你应该把那个垃圾桶放在问题中。2) 在EclipseXML查看器中似乎没有显示“普通”自定义视图。请参阅:这将返回一个错误。“最终空白字段MSHADOWDAWABLE可能尚未初始化”MSHADOWDAWABLE是一个drawable@alexsummers这不是一个错误,而是一个警告。你可以放心地忽略它。不,仍然不会渲染。@Alexammers它不会渲染。Eclipse和IntelliJ中的UI编辑器不用于呈现复杂的自定义视图。但是,这两行代码阻止UI编辑器发出这些警告,说明无法呈现自定义视图。应该是一个在线应用程序,您可以在其中粘贴java+xml,它允许您创建自定义视图并对其进行编辑