मैं एंड्रॉइड ऐप के विकास के लिए नया हूं क्योंकि मैं स्पिनर बना रहा था, मैंने ड्रॉप डाउन की शुरुआत और अंत में स्पिनर की सूची ड्रॉप करने के लिए लंबवत अतिरिक्त स्थान/पैडिंग देखा।एंड्रॉइड स्पिनर ड्रॉपडाउन वर्टिकल अतिरिक्त स्पेस/पैडिंग
MainActivity.java:
public class MainActivity extends AppCompatActivity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Spinner sr = (Spinner) findViewById(R.id.spinner);
String[] days = getResources().getStringArray(R.array.days);
ArrayAdapter<String> ar = new ArrayAdapter<>(this, R.layout.single_row, days);
sr.setAdapter(ar);
}
}
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#666666"
tools:context="com.xxxxx.defaultspinner.MainActivity">
<Spinner
android:id="@+id/spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:spinnerMode="dialog"
android:background="#898989">
</Spinner>
</RelativeLayout>
single_row.xml
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/app_name"
android:textColor="#FFFFFF"
android:textSize="26sp"
android:background="#214161">
</TextView>
मैंने सभी विचारों की पृष्ठभूमि को अलग-अलग रंगों में सेट किया ताकि मैं अतिरिक्त स्थान/पैडिंग के स्रोत की पहचान कर सकूं। लेकिन अतिरिक्त स्थान/पैडिंग में सफेद पृष्ठभूमि है जिसमें कोई भी दृश्य नहीं है।
नोट यह नहीं spinnerMode = "संवाद" विकल्प की वजह से है। यह व्यवहार तब भी होता है जब स्पिनरमोड = "ड्रॉपडाउन"। मैं इस जगह को कैसे हटा सकता हूं? या मैं कुछ गलत कर रहा हूँ?
मैं भी TextView से ही समस्या का सामना करना पड़ रहा हूँ – Rohit