-1

here my XML code to create the Spinner with TextView in the RelativeLayout. here i need this design pattern dynamically with the exact style. u can find the style here http://i62.tinypic.com/5ysvia.png

<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_marginLeft="15dp"
    android:layout_marginRight="15dp"
    android:layout_marginTop="10dp" >`

<Spinner
        android:id="@+id/spinner_ApproveLine"
        style="@style/spinner_style"

        android:paddingLeft="90dp"
        android:layout_marginLeft="-2dp"
        android:layout_marginTop="0dp"
        android:paddingRight="5dp"

        android:layout_width="fill_parent"
        android:layout_height="45dp"
        android:orientation="vertical"
        android:layout_alignBottom="@+id/relativeLayout_app"/>

<LinearLayout
        android:id="@+id/relativeLayout_app"
        android:layout_width="85dp"
        android:layout_height="43dp"
        android:orientation="vertical"
        android:background="@drawable/icon_label_bg" >

         <TextView
            android:id="@+id/Approve"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:paddingRight="5dp"
            android:paddingTop="7dp"
            android:text="@string/text_approval"
            android:textColor="@color/tab_color"
            android:layout_gravity="right"
            android:textSize="12sp" />

        <TextView
            android:id="@+id/Line"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:paddingBottom="5dp"
            android:paddingRight="5dp"
            android:text="@string/text_line"
            android:textColor="@color/tab_color"
            android:layout_gravity="right"
            android:textSize="12sp" />

    </LinearLayout>
</RelativeLayout>

this is my static XML code . i want this exact style dynamically and populate the data dynamically

Thank You !!!

praba
  • 3
  • 4

2 Answers2

0

i just modified your code

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_marginLeft="15dp"
    android:layout_marginRight="15dp"
    android:layout_marginTop="10dp" >`

<Spinner
    android:id="@+id/spinner_ApproveLine"
    android:layout_width="match_parent"
    android:layout_height="45dp"
    android:layout_alignBottom="@+id/relativeLayout_app"
    android:layout_marginTop="0dp"
    android:layout_toRightOf="@+id/relativeLayout_app"
    android:orientation="vertical"
    android:paddingRight="5dp" />

<LinearLayout
        android:id="@+id/relativeLayout_app"
        android:layout_width="85dp"
        android:layout_height="43dp"
        android:orientation="vertical"
         >

         <TextView
             android:id="@+id/Approve"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_gravity="right"
             android:paddingRight="5dp"
             android:paddingTop="7dp"
             android:textSize="12sp" />

        <TextView
            android:id="@+id/Line"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="right"
            android:paddingBottom="5dp"
            android:paddingRight="5dp"
            android:textSize="12sp" />

    </LinearLayout>
</RelativeLayout>
Meghna
  • 539
  • 4
  • 14
  • this is the sample one i have statically . i want this to be achieved pragmatically ? any idea ? do i need to inflate with dummy or i have to create new ? – praba Jul 11 '14 at 11:30
  • then create custom list view in listview create two field text n spinner – Meghna Jul 11 '14 at 11:35
  • its not a list view witty ! its just a spinner , all am worrying is abt the exact format what i have there ? u can click the link and view the image @Meghna – praba Jul 11 '14 at 11:39
  • why u want it programmatically.also i m not saying to change your spinner. – Meghna Jul 11 '14 at 11:41
  • in my case , the number of spinner is varying for diff users . the data for the spinner items too !!! spinner item and the label for the spinner to be populated with the Dynamic JSON content ... find the spinner image here @Meghna [link]([IMG]http://i60.tinypic.com/10er1x4.png[/IMG])[IMG]http://i60.tinypic.com/10er1x4.png[/IMG] – praba Jul 11 '14 at 11:46
  • [IMG]http://i60.tinypic.com/10er1x4.png[/IMG] its like a form , which contains several spinner already , i need to create a new spinner dynamically with the existing style ... u can find the style in the image link @Meghna this the sample style . – praba Jul 11 '14 at 11:50
  • you want to create spinner dynamically??As u said u r getting spinner n data.can you tell exactly wht type of style u are getting?? – Meghna Jul 11 '14 at 12:02
  • Yes , dynamically . i am getting label , and spinner one by one, and not the same design which i mention in the image link – praba Jul 11 '14 at 12:05
  • dept. A/c,dept.Admin these are spinner..all are containing some value.if it s,i have already said u create Custom Listview with Text and Spinner,not simple Listview i am saying.Mark it.check it http://stackoverflow.com/questions/3952375/android-listview-with-spinner-and-a-checkbox.it may help ur requirement – Meghna Jul 11 '14 at 12:12
0

Try This

android:dropDownSelector=""
arulmr
  • 8,620
  • 9
  • 54
  • 69
DJhon
  • 1,548
  • 3
  • 22
  • 39
  • http://i62.tinypic.com/5ysvia.png refer this image , values for the dropdown is from Web service , then how to populate it . everything needs to be done dynamically – praba Jul 11 '14 at 12:30