Dropdown box android layout code

Activity Forums Android mobile app Dropdown box android layout code

  • This topic is empty.
  • Creator
    Topic
  • #130
    adcocitclass
    Keymaster

    To create dropdown box in android java layout,

    1. Create dropdown values as string-array in strings.xml


    Select Category

    Automobile
    Business
    Realestate
    Services
    BuyandSell
    Travel
    Jobs

    2. Create following spinner element in your layout to use above dropdown values for dropdown boxes



    android:id="@+id/catSpinner"
    android:layout_width="200dp"
    android:layout_height="wrap_content"
    android:layout_margin="5dp"
    android:layout_marginTop="10dp"
    android:layout_below="@id/catText"
    android:entries="@array/category_array"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:prompt="@string/spinner_title"
    />

  • You must be logged in to reply to this topic.