Hello, how can I align the align buttons on the right side, one under the other of the code, in the class ButtonsLayout?
public class Activity extends Activity { private GLSurfaceView glView; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); glView = new GLSurfaceView(this); // glView здесь куча параметров для glView которые по идее не имеют отношения к вопросу this.setContentView(glView); this.addContentView(new ButtonsLayout(this), new WindowManager.LayoutParams(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT)); } } Here is the ButtonsLayout class.
public class ButtonsLayout extends LinearLayout { public ButtonsLayout(Context context) { super(context); LinearLayout.LayoutParams rightGravityParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); rightGravityParams.gravity = Gravity.RIGHT; Button btn1 = new Button(context); btn1.setText("Button1"); addView(btn1, rightGravityParams); Button btn2 = new Button(context); btn2.setText("Button2"); addView(btn2, rightGravityParams); } } I need the buttons to be on the right and one below the other. And I get that they are on the left and on one line.
LayoutInflater inflater = getLayoutInflater(); View tmpView; tmpView = inflater.inflate(R.layout.extra_layout, null); getWindow().addContentView(tmpView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));- BarmaleyR.layout.testlook? Such a feeling axis does not seetest.xml- Barmaley