मैं 3 लाइनरलाइट्स को व्यवस्थित करने की कोशिश कर रहा हूं, जैसे कि बायीं तरफ उचित है, एक दाईं ओर, और तीसरा दोनों तरफ बराबर रिक्त स्थान के साथ दोनों के बीच है। मुझे लगता है कि मैं इसे पूरा करने के लिए एक रिलेटिवलाउट में लपेटता हूं। फिर संरेखित करने के लिए एक लेआउट सेट करें और पैरेंट राइट संरेखित करने के लिए दूसरा लेआउट सेट करें। लेकिन तीसरे लेआउट के लिए, मैं layout_marginLeft = (RelativeLayout.width - (layout1.width + layout2.width + layout3.width) सेट करना चाहता हूं)/2। हालांकि, मुझे नहीं लगता कि यह xml में कैसे करें। कोई सुझाव?एंड्रॉइड: रिलेवेटिवआउट के भीतर समान रूप से अंतरिक्ष घटक कैसे?
* संपादित करें। सुझावों के आधार पर, अब मैं एक लीनियरलाउट का उपयोग कर रहा हूं। यह काम करने के करीब है, लेकिन 3 लेआउट समान रूप से दूरी पर नहीं हैं, और सही लेआउट सही नहीं है।
<LinearLayout
android:id="@+id/toolbar"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:paddingTop="4dip"
android:paddingBottom="4dip"
android:background="#50000000"
android:visibility="visible">
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_weight="1"
android:layout_height="wrap_content">
<ImageButton
android:id="@+id/open"
android:src="@drawable/open"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</ImageButton>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_weight="1"
android:layout_height="wrap_content">
<ImageButton
android:id="@+id/prev"
android:src="@drawable/prev"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</ImageButton>
<TextView
android:id="@+id/totalpages"
android:text="0 of 0"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FFFFFFFF">
</TextView>
<ImageButton
android:id="@+id/next"
android:src="@drawable/next"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</ImageButton>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_gravity="right"
android:layout_width="wrap_content"
android:layout_weight="1"
android:layout_height="wrap_content">
<ImageButton
android:id="@+id/zoomout"
android:src="@drawable/zoomout"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</ImageButton>
<ImageButton
android:id="@+id/zoomin"
android:src="@drawable/zoomin"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</ImageButton>
</LinearLayout>
</LinearLayout>
बस इस उत्तर में शामिल होने के लिए: एक लीनियरलाउट (एक लीनियरलाउट के भीतर तीन लीनियरलाइट्स) के साथ जाएं, सभी चौड़ाई को fill_parent पर सेट करें, और आंतरिक तीन लेआउट 'एंड्रॉइड दें: layout_weight =" 1 "'। – kcoppock
धन्यवाद, यह मुझे करीब मिला है, लेकिन मेरे लिए काफी काम नहीं करता है। यह 3 लाइनरलेआउट्स को एक ही आकार के लिए मजबूर करता है, लेकिन मेरे लाइनरलेआउट में अलग-अलग सामग्री होती है। कृपया मेरा संपादन देखें। – ab11
तो आपके पास तीन बटन हैं और मैं अनुमान लगा रहा हूं कि उन तीन बटन एक ही चौड़ाई के नहीं हैं। यह एक मुश्किल मामला होगा। मैं छवि आकार को कम करने का सुझाव दूंगा ताकि सभी बटन अच्छे लगें और फसल न जाए। उदाहरण के लिए ट्विटर/फेसबुक ऐप देखें। यदि यह संभव नहीं है तो तय करें कि प्रत्येक बटन की न्यूनतम चौड़ाई क्या होनी चाहिए और उन्हें निर्दिष्ट करें [स्क्रीन आकार पर भी निर्भर करता है]। और इसके बाद मैं सुझाव दे सकता हूं कि उसके आसपास खेलना और देखें कि आपके लिए सबसे अच्छा क्या काम करता है। – achie