Reputation: 13
enter image description here[I have 4 Spinner, After selection first spinner second spinner item will come.When I open the page it shows like image,first one text is in proper position but third element have some gap,when I choose my item of first one then second one automatically take one of its list and there have no gap which I mentioned in image. Please help me regarding this.
This spinner in my layout
<Spinner
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:entries="@array/subloc"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingTop="10dp"
android:textSize="18sp"
/>
Spinner item is:
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:textColor="#000"
android:textSize="15sp"
android:text="dvvdv"/>
]
Upvotes: 0
Views: 102
Reputation: 695
Probably you have added space before Select Subnature String. Try to remove that space.
Upvotes: 0
Reputation: 937
Step1: Try to use default android.R.layout.simple_spinner_dropdown_item for spinner drop down it will show perfectly without any space orelse
//Step2:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/spinner1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:hint="Select item"
android:background="@drawable/spin"/>
</RelativeLayout>
Upvotes: 1
Reputation: 3887
Try to change the Spinner Item like the below.
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:textColor="#000"
android:paddingTop="15dp"
android:paddingBottom="15dp"
android:textSize="15sp"
android:text="dvvdv"/>
Upvotes: 0