I want to show the Reginonal language(Gurumukhi) in my Android app

后端 未结 3 854
广开言路
广开言路 2020-12-20 20:46

I want the output as shown in below image

\"This

This is a Sikh holy book which

3条回答
  •  温柔的废话
    2020-12-20 21:22

    Update Since you want to use via XML Your layout.xml should be like

    
    
    
        
    
    
    

    and string.xml

    
    
    
    
         siq nwmu krqw purKu inrBau inrvYruAkwl mUriq AjUnI sYBM gur pRswid ]] jpu ]Awid scu jugwid scu ]hY BI scu nwnk hosI BI scu ]1]socY soic n hoveI jy socI lK vwr ]cupY cup n hoveI jy lwie rhw ilv qwr ]BuiKAw BuK n auqrI jy bMnw purIAw Bwr ]shs isAwxpw lK hoih q iek n clY nwil ]ikv sicAwrw hoeIAY ikv kUVY qutY pwil ]hukim rjweI clxw nwnk iliKAw nwil ]1]hukmI hovin Awkwr hukmu n kihAw jweI ]hukmI hovin]]>
    
    

    Hello Extend your textview

    package com.nannu;
    
    import android.content.Context;
    import android.graphics.Typeface;
    import android.util.AttributeSet;
    import android.widget.TextView;
    
    public class NanTV extends TextView{
    
        private Context c;
        public NanTV(Context c) {
            super(c);
            this.c = c;
            Typeface tfs = Typeface.createFromAsset(c.getAssets(),
                    "font/bulara_5.ttf");
            setTypeface(tfs);
    
        }
        public NanTV(Context context, AttributeSet attrs, int defStyle) {
            super(context, attrs, defStyle);
            this.c = context;
            Typeface tfs = Typeface.createFromAsset(c.getAssets(),
                    "font/bulara_5.ttf");
            setTypeface(tfs);
            // TODO Auto-generated constructor stub
        }
    
        public NanTV(Context context, AttributeSet attrs) {
            super(context, attrs);
            this.c = context;
            Typeface tfs = Typeface.createFromAsset(c.getAssets(),
                    "font/bulara_5.ttf");
            setTypeface(tfs);
    
        }
    
    
    }
    

    Now Your layout.xml

    
    
    
        
    
    
    

    Activity

    package com.nannu;
    
    import android.app.Activity;
    import android.os.Bundle;
    
    public class NanDempoActivity extends Activity {
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
    
            NanTV nan = (NanTV)findViewById(R.id.textView1);
            nan.setText("jpujI swihb<> siq nwmu krqw purKu inrBau inrvYruAkwl mUriq AjUnI sYBM gur pRswid ]] jpu ]Awid scu jugwid scu ]hY BI scu nwnk hosI BI scu ]1]socY soic n hoveI jy socI lK vwr ]cupY cup n hoveI jy lwie rhw ilv qwr ]BuiKAw BuK n auqrI jy bMnw purIAw Bwr ]shs isAwxpw lK hoih q iek n clY nwil ]ikv sicAwrw hoeIAY ikv kUVY qutY pwil ]hukim rjweI clxw nwnk iliKAw nwil ]1]hukmI hovin Awkwr hukmu n kihAw jweI ]hukmI hovin");
        }
    }
    

    Final Output

提交回复
热议问题