开发者

Japanese Characters display weird spacing in Android TextView and Buttons

开发者 https://www.devze.com 2023-02-13 06:27 出处:网络
I\'m trying to localize an android app to Japanese.I dropped in the japanese strings xml file and everything is pretty good except for Katakana characters with the two little dashes or the little circ

I'm trying to localize an android app to Japanese. I dropped in the japanese strings xml file and everything is pretty good except for Katakana characters with the two little dashes or the little circle in the top right. For those characters the display takes up the width of 2 full characters.

Here's a simple example showing the spacing problem with the word "website" in katakana:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
>
    <TextView  
        android:la开发者_C百科yout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:text="ウェブサイト"       
        android:typeface="normal"/>
</LinearLayout>

When it displays on the phone, the 3rd character takes up an extra space. Any ideas what's going wrong?


Try change the character "ブ" -> "ブ".
The 3rd character is not used ordinary Japanese in UTF-8.


Try externalizing the string into strings.xml. Doing that I don't have this problem.

0

精彩评论

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

关注公众号