我正在通过WP-CodeBox插件撰写一篇关于Android的博客,并希望将layout.xml添加到博客中,如下所示:
<pre><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<ImageView android:id="@+id/icon"
android:layout_width="@dimen/notification_large_icon_width"
android:layout_height="@dimen/notification_large_icon_height"
android:background="@android:drawable/bg_tile"
android:scaleType="center"
/>
</LinearLayout></pre>
在HTML模式下,当我将编辑模式更改为可视模式时,xml是GONE!请帮我看看如何在xml模式下显示没有格式错误的xml。在wordpress中还有其他xml编辑插件吗?谢谢!
答案 0 :(得分:1)
您可以使用this荧光笔。这将为您提供XML的输出(使用Eclipse样式):
<pre style='color:#000000;background:#ffffff;'><span style='color:#7f0055; '><</span><span style='color:#7f0055; '>LinearLayout</span> xmlns:android=<span style='color:#2a00ff; '>"</span><span style='color:#2a00ff; '>http</span><span style='color:#2a00ff; '>:</span><span style='color:#7f0055; font-weight:bold; '>//</span><span style='color:#3f3fbf; '>schemas.android.com</span><span style='color:#3f3fbf; '>/apk/res/android</span><span style='color:#2a00ff; '>"</span>
android:layout_width=<span style='color:#2a00ff; '>"</span><span style='color:#2a00ff; '>match_parent</span><span style='color:#2a00ff; '>"</span>
android:layout_height=<span style='color:#2a00ff; '>"</span><span style='color:#2a00ff; '>match_parent</span><span style='color:#2a00ff; '>"</span>
<span style='color:#7f0055; '>></span>
<span style='color:#7f0055; '><</span><span style='color:#7f0055; '>ImageView</span> android:id=<span style='color:#2a00ff; '>"</span><span style='color:#2a00ff; '>@+id/icon</span><span style='color:#2a00ff; '>"</span>
android:layout_width=<span style='color:#2a00ff; '>"</span><span style='color:#2a00ff; '>@dimen/notification_large_icon_width</span><span style='color:#2a00ff; '>"</span>
android:layout_height=<span style='color:#2a00ff; '>"</span><span style='color:#2a00ff; '>@dimen/notification_large_icon_height</span><span style='color:#2a00ff; '>"</span>
android:background=<span style='color:#2a00ff; '>"</span><span style='color:#2a00ff; '>@android:drawable/bg_tile</span><span style='color:#2a00ff; '>"</span>
android:scaleType=<span style='color:#2a00ff; '>"</span><span style='color:#2a00ff; '>center</span><span style='color:#2a00ff; '>"</span>
<span style='color:#7f0055; '>/></span>
<span style='color:#7f0055; '></</span><span style='color:#7f0055; '>LinearLayout</span><span style='color:#7f0055; '>></span>
</pre>
看起来像这样: