在我的應用程序中,如果用戶單擊imageview,textview的字體大小應該會改變。如果用戶再次單擊相同的imageview,則文本應設置爲之前的字體。TextView字體更改
在我adpater類:
public View getView(int position, View convertView, ViewGroup parent)
{
this.Position=position;
// TODO Auto-generated method stub
rowView = LayoutInflater
.from(parent.getContext())
.inflate(R.layout.newsdescriptionrow, null);
TextView prevnews=(TextView)rowView.findViewById(R.id.prevnews);
TextView nextnews=(TextView)rowView.findViewById(R.id.nextnews);
ImageView img=(ImageView)rowView.findViewById(R.id.fontimage);
img.setImageResource(mImageIds);
img.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
if(!fontselection)
{
font=20;
fontselection = true;
}
else
{
System.out.println("inside else..");
font = 10;
fontselection = false;
}
// font=20;
TextView textView = (TextView) rowView
.findViewById(R.id.name_Desclabel);
textView.setText(body[Position]);
System.out.println("fontsasss="+font);
textView.setTextSize(font);
}
});
我要去的地方在advanve wrong.please幫助me..Thanks ..
第二次進入onClickListener嗎? –
雅其Shreya Shah ..但字體大小不設置爲10 ... – Subburaj
它是否去其他內部? –