Пример #1
0
  @Override
  public void onCreate(Context ctx) {

    LinearLayout linearLayout = new LinearLayout(ctx);
    linearLayout.setOrientation(LinearLayout.VERTICAL);

    // beds
    Spinner spinnerTextField = new Spinner(ctx);
    ArrayAdapter<Integer> aa =
        new ArrayAdapter<Integer>(
            ctx, android.R.layout.simple_spinner_item, new Integer[] {1, 2, 3});
    aa.setDropDownViewResource(android.R.layout.select_dialog_singlechoice);
    spinnerTextField.setAdapter(aa);
    spinnerTextField.setOnItemSelectedListener(bedCountSpinnerItemSelectionListener);

    // options
    TableLayout amenitiesLayout = new TableLayout(ctx);
    amenitiesLayout.setColumnStretchable(0, false);
    amenitiesLayout.setColumnShrinkable(1, true);
    Amenity[] ams = Amenity.values();
    for (Amenity amenity : ams) {
      TableRow tableRow = buildAmenityTableRow(ctx, amenity);
      amenitiesLayout.addView(tableRow);
    }

    linearLayout.addView(
        Utils.buildLabelAndField(ctx, ctx.getString(R.string.beds_label), spinnerTextField));
    linearLayout.addView(
        Utils.buildLabelAndField(ctx, ctx.getString(R.string.amenities_label), amenitiesLayout));

    addView(linearLayout);
  }
Пример #2
0
 void dialogShow() {
   dialogLayout.setColumnShrinkable(0, true);
   dialogLayout.setColumnShrinkable(1, true);
   dialogLayout.setColumnStretchable(1, true);
   dialog.show();
 }