Hello. I want to create a own View which containst two buttons without useing xml.
I tried this:
public class ZoomPlate extends LinearLayout{
private Context context;
private Button plus; private Button minus;
public ZoomPlate(Context context) { super(context); init(context);
}
public ZoomPlate(Context context, AttributeSet attrs) { super(context, attrs); init(context); }
private void init(Context context){ this.context = context;
LayoutParams params = new >LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT,0); plus = new Button(context); plus.setText("Plus"); plus.setLayoutParams(params); minus = new Button(context); minus.setText("Minus"); minus.setLayoutParams(params); setOrientation(LinearLayout.VERTICAL); addView(plus); addView(minus);
}
so that i can use the Zoomplate in XML like a button or a textview like:
but when i try this nothing gets displayd