求解决为什么为这样
public class bar extends RelativeLayout {
private Button leftButton,rightButton;
private TextView tvTitle;
private int leftTextColor;
private Drawable leftBackground;
private String leftText;
private int rightTextColor;
private Drawable rightBackground;
private String rightText;
private int titleTextColor;
private float titleTextSize;
private String titleText;
public bar(Context context, AttributeSet attrs) {
super(context, attrs);
TypedArray ta= context.obtainStyledAttributes(attrs,R.styleable.Topbar);
leftTextColor=ta.getColor(R.styleable.Topbar_leftTextColor, 0);
leftBackground=ta.getDrawable(R.styleable.Topbar_leftBackground);
leftText=ta.getString(R.styleable.Topbar_leftText);
rightTextColor=ta.getColor(R.styleable.Topbar_rightTextColor, 0);
rightBackground=ta.getDrawable(R.styleable.Topbar_rightBackground);
rightText=ta.getString(R.styleable.Topbar_rightText);
titleTextColor=ta.getColor(R.styleable.Topbar_titleTextColor, 0);
titleTextSize=ta.getDimension(R.styleable.Topbar_titileTextSize, 0);
titleText=ta.getString(R.styleable.Topbar_title);
ta.recycle();
leftButton=new Button(context);
rightButton=new Button(context);
tvTitle=new TextView(context);
leftButton.setTextColor(leftTextColor);
leftButton.setBackground(leftBackground);
leftButton.setText(leftText);
rightButton.setTextColor(rightTextColor);
rightButton.setBackground(rightBackground);
rightButton.setText(rightText);
tvTitle.setText(titleText);
tvTitle.setTextColor(titleTextColor);
tvTitle.setTextSize(titleTextSize);
}
}
加粗有下划线的位置 android studio 会变红色波浪线 报错。
错误代码提示如下:
最低版本选的是4.0