界面的xml代码如下:
[code="java"]
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:textSize="18sp" />
<EditText android:id="@+id/title" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:textSize="18sp"
android:maxLength="50" />
<TextView android:text="内容"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:textSize="18sp" />
<ScrollView android:layout_width="fill_parent"
android:layout_height="fill_parent">
<EditText android:id="@+id/content" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:textSize="18sp" />
</ScrollView>
[/code]
如图,由于我们使用了中文,可视界面里变成了方框:
[img]/upload/attachment/137355/e54e1612-33a9-3c7f-866d-c0cb0d316c72.jpg[/img]
虽然最终打包放到模拟器上的界面显示的不是乱码,但是这个也比较的影响开发调试吧?
不知道大家有没有什么好的解决方法呢?
[b]问题补充:[/b]
1,其实原本就是放在string.xml里面的,这里直接在text里面赋值只是为了描述的方便,懒得多贴一段代码。
2,模拟器上显示正常,这里说的是在eclipse下的xml编辑的view界面会显示成为乱码。
[b]问题补充:[/b]
唉,这个就没办法解决了吗? :?
或者我要考虑做一下国际化,开发的时候用因为,测试的时候用中文。
哦,你说的意思是你的xml里面的layout显示是乱码是吧!?
那里中文本来就显示不出来,但那根本就不会影响你的程序吧,调试的时候也不会有影响的,至少我开发中没有影响过
呵呵,你为什么非要改那里的东东呢?
不要在text里面直接赋值,这样是会显示不出中文的,你可以像这样,把text的值放到string里面,那么在layout里面配置则是: android:text="@string/text",然后在你的res/values/strings.xml里面添加一条string: 标题
这样在模拟器上面就可以显示中文了。
SDK版本问题 1.5的就是乱码,2.1以上OK