Reputation: 2643
Hi all I have a question ,if someone can help me implement this design or give me a path to look from. Actually i want to implement this UI , a user can select one ore more days ,when he selecte a day the fond of the day become bold when he unselect the day the style of the day become normal like Saturday in our case i tried to implement this UI using toogle button but unfortunately i failed can anyone help me achieve this goal
thank you all for your help
Upvotes: 0
Views: 40
Reputation: 2635
You could have something like this if you are using multiple TextView's in something like a LinearLayout.
public class BoldTextView extends TextView implements View.OnClickListener {
private boolean bold = false;
public BoldTextView(Context context) {
this(context, null);
}
public BoldTextView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public BoldTextView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
setOnClickListener(this);
}
@Override
public void onClick(View v) {
if (bold) {
bold = false;
setTypeface(null, Typeface.NORMAL);
} else {
bold = true;
setTypeface(null, Typeface.BOLD);
}
}
public boolean isBold() {
return bold;
}
}
Upvotes: 1