开发者

Android edit text

I am working with an edit text to support the properties of bold,italic and underline.I got succeed after selecting the text and clicking on bold my text was bold.Now what my requirement is how to remove the bold again after selecting the text and clicking on bo开发者_JAVA百科ld button.

Regards,

Bhavani.G


It is not simply setting the flag to do bold and remove the bold.We have to know the text we have selected is in bold and if it is bold then we have to remove the bold by clicking the same button..

Regards,

Bhavani


You need to keep a bold flag so that you check the current status of the flag and do the opposite.

Some thing like this:

Boolean isBold = false;
.
.
.
boldText()
{
  if(isBold){
      //unbold 
      setTypeface( <What you need> )
      isbold=false;
  }
  else {
      //bold 
      setTypeface( <What you need> )
      isbold=true;
  }
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜