I work with edit text to support bold, italic, and underline properties. I managed to succeed after selecting the text and making it bold. Now I want to remove the bold font after clicking on the "Normal" button.
Typeface.NORMAL does not work here. Can anyone suggest another option.
Button btnBold = (Button) findViewById(R.id.btnBold);
btnBold.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
startSelection = etx.getSelectionStart();
endSelection = etx.getSelectionEnd();
Spannable s = etx.getText();
s.setSpan(new StyleSpan(android.graphics.Typeface.BOLD), startSelection, endSelection, 0);
}
});
Button btnNormal = (Button) findViewById(R.id.btnNormal );
btnNormal .setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
**
}
});
source
share