<LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:id="@+id/layout1" > <NumberPicker android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/picker1" android:layout_marginRight="20dp" android:layout_marginEnd="20dp"></NumberPicker> <NumberPicker android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/picker2" ></NumberPicker> </LinearLayout> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/layout1" android:text="SUBMIT" android:layout_centerInParent="true" android:layout_margin="10dp" />
public class MainActivity extends AppCompatActivity { NumberPicker pick1,pick2; Button btnsubmit; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); pick1 = (NumberPicker)findViewById(R.id.picker1); pick2 = (NumberPicker)findViewById(R.id.picker2); pick1.setMinValue(1); pick1.setMaxValue(7); pick2.setMinValue(0); pick2.setMaxValue(12); btnsubmit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { try { } catch (Exception e) { e.getMessage(); } } }); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)