Thursday, May 2, 2013

Change circle image of radio button android

change circle image of radio button

go to drawable folder and create a xml file named button_radio.xml

paste this in button_radio.xml file


<?xml version="1.0" encoding="UTF-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:drawable="@drawable/radio_on" android:state_checked="true" android:state_pressed="false"/>
    <item android:drawable="@drawable/radio_off" android:state_checked="false" android:state_pressed="false"/>

</selector>


now downlaod these images radio_off.png , radio_on.png here


put these images in drawable folder

now in Activity file
put


RadioButton rb1;

rb1.setButtonDrawable(R.drawable.button_radio);





Wednesday, May 1, 2013

Use external fonts in android programming

Use hindi fonts android programming
Use external fonts android programming

Inside the assets folder of your project create a new folder and name it as fonts. Copy the font(.ttf) files in this folder. In our case the font files are RockFont.ttf and FEASFBRG.TTF.


setContentView(R.layout.main);
        Typeface font1 = Typeface.createFromAsset(getAssets(), "fonts/RockFont.ttf");
        Typeface font2 = Typeface.createFromAsset(getAssets(), "fonts/FEASFBRG.TTF");
        TextView customText1 = (TextView)findViewById(R.id.text1);
        TextView customText2 = (TextView)findViewById(R.id.text2);

        customText1.setTypeface(font1);
        customText1.setTextSize(40.f);
        customText1.setText("Hello! This is a custom font...");
        
        customText2.setTypeface(font2);
        customText2.setTextSize(30.f);
        customText2.setText("Developed by www.bOtskOOl.com");