开发者

Android edit text

开发者 https://www.devze.com 2023-01-06 01:53 出处:网络
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 rem

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

精彩评论

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