मेरे पास एक क्षैतिज स्क्रॉलव्यू है जो टेक्स्टव्यू के साथ गतिशील रूप से भरा हुआ है। कभी-कभी एक, दो, तीन या अधिक तत्व होते हैं। जो मैं खोज रहा हूं वह तत्वों की संख्या के बावजूद आइटम केंद्रित करने का एक तरीका है।केंद्रित तत्वों के साथ क्षैतिज स्क्रॉलव्यू
उदाहरण के लिए, एक तत्व के साथ: तीन तत्वों के साथ
| ---- MenuA --- MenuB ---- |
:
| --------- MenuA --------- |
दो तत्वों के साथ
| - MenuA - MenuB - MenuC - |
पांच तत्वों के साथ (MenuD और menue छिपे हुए हैं) :
| MenuA - MenuB - MenuC - Me|
अद्यतन: यहां दो मेनू के साथ एक साधारण लेआउट है। मैं मेनू ए और मेनूबी कैसे केंद्रित करूं?
एंड्रॉयड: layout_gravity = "center_horizontal" संपादित करें: ०३.३०:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<HorizontalScrollView android:id="@+id/horizontalScrollView1"
android:layout_width="wrap_content" android:layout_height="wrap_content">
<LinearLayout android:id="@+id/linearLayout1"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:orientation="horizontal">
<TextView android:text="MenuA" android:id="@+id/textView1"
android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
<TextView android:text="MenuB" android:id="@+id/textView2"
android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
</LinearLayout>
</HorizontalScrollView>
</LinearLayout>
तो आपका 'स्कॉल व्यू' क्षैतिज (स्क्रीन से बड़ा) है, आइटम स्क्रीन केंद्रित हैं? – Phonon
हां, मेरा क्षैतिज स्क्रॉलव्यू क्षैतिज है, और आइटम क्षैतिज रूप से केंद्रित होना चाहिए –