2016-07-23 48 views
0

這是我的Java活動在智能手機中顯示unicode?

public class word extends Activity implements View.OnClickListener{ 
EditText et; 
Button btnz,btncopy; 
TextView tv; 
@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.word); 
    et =(EditText)findViewById(R.id.et); 
    btnz =(Button)findViewById(R.id.btnz); 
    btncopy =(Button)findViewById(R.id.btnc); 
    tv =(TextView)findViewById(R.id.tv); 
    btnz.setOnClickListener(new View.OnClickListener() { 
     @Override 
     public void onClick(View v) { 
      String a ="a"; 
      String b ="b"; 
      String c ="c"; 
      String d ="d"; 
      String e ="e"; 
      String f ="f"; 
      String g ="g"; 
      String h ="h"; 
      String a1 ="\u24B6"; 
      String b1 ="\u24B7"; 
      String c1 ="\u24B7"; 
      String d1 ="\u24B9"; 
      String e1 ="\u24BB"; 
      String f1 ="\u24BB"; 
      String g1 ="\u24BD"; 
      String h1 ="\u24BD"; 
      String name =et.getText().toString(); 
      name =name.replaceAll(a,a1); 
      name =name.replaceAll(b,b1); 
      name =name.replaceAll(c,c1); 
      name =name.replaceAll(d,d1); 
      name =name.replaceAll(e,e1); 
      name =name.replaceAll(f,f1); 
      name =name.replaceAll(g,g1); 
      name =name.replaceAll(h,h1); 
      tv.setText(name); 

當AVD運行,並在寫的EditText它的工作,但在我的智能手機上運行時不顯示一切 我是verey努力和互聯網搜索。 什麼是解決方案? 對不起,我的語法請不要忽略

回答

0

除非您使用的字體具有該字符的字形,否則屏幕上將不會顯示字符。檢查TextView正在使用的字體,然後查明該字體是否包含字符"\u24B6"(圓圈A =Ⓐ)的字形。如果不是,則需要使用不同的字體。

+0

http://www.codeproject.com/Questions/1114251/How-copy-text-with-font –

+0

@ p.karimdost:歡迎來到S.O.你能爲你的評論鏈接提供一些上下文嗎?該鏈接指向另一個網站上關於複製字體的文本問題,可能由您發佈。有一個答案指向ClipData的文檔。那麼結果是使用正確的字體確實是問題嗎?如果我的回答是正確的,並引導您找到解決方案,請考慮通過點擊複選標記來接受它。 – LarsH