अच्छी तरह से आप गोलियाँ पर लेकिन अगर फोन हाँ आप कर सकते हैं नीचे स्थित रहने के लिए बाध्य नहीं कर सकता मैनिफेस्ट के माध्यम से करो। लेकिन आप कुछ कर सकते हैं नीचे बार और शीर्ष बार के समान है। इस उदाहरण में मैं आपको दिखाऊंगा कि एंड्रॉइड एक्शनबार का उपयोग किए बिना आसानी से ऐसा करने के लिए विलय का उपयोग कैसे करें।
पहली चीज़ जो आपको बनाने की जरूरत है वह है main_activity.xml
मेरे मामले में main_activity.xml
में केवल ImageView
रिलेवेटिवआउट पर है। यहाँ कोड है।
<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"
tools:context=".MainActivity" >
<RelativeLayout android:id="@+id/RelativeLayout04"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:layout_alignParentTop="true">
<include layout="@layout/header" />
</RelativeLayout>
<ImageView
android:id="@+id/view"
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_above="@+id/RelativeLayout03"
android:layout_below="@+id/RelativeLayout04"
android:layout_centerHorizontal="true"
android:src="@android:drawable/alert_dark_frame" />
<RelativeLayout android:id="@+id/RelativeLayout03"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<include layout="@layout/tryit" />
</RelativeLayout>
आप कोड ऊपर में देख सकते हैं, वहाँ दो मर्ज के मैं main_activity.xml
एक तल पर परिभाषित किया और एक शीर्ष पर परिभाषित के अंदर डाल रहे हैं। यहां नकली नीचे बार xml है।
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout
android:id="@+id/LinearLayout01"
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_weight="0.14"
android:background="@drawable/dock" >
<ImageView
android:id="@+id/dark"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="0.14" />
<ImageView
android:id="@+id/stock"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="0.14" />
<ImageView
android:id="@+id/open"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="0.14" />
<ImageView
android:id="@+id/border"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="0.15" />
<ImageView
android:id="@+id/color"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="0.15"
/>
</LinearLayout>
मैं onClicks के लिए LinearLayout
को एक निश्चित पृष्ठभूमि और नकली imageView डाल रहा हूं।
और यहां शीर्ष बार है। `
<LinearLayout
android:id="@+id/LinearLayout02"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_weight="0.14"
android:background="@drawable/dock1"
android:layout_gravity="top">
<ImageView
android:id="@+id/darka"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="0.14" />
<ImageView
android:id="@+id/stocka"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="0.14" />
<ImageView
android:id="@+id/opena"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="0.14" />
<ImageView
android:id="@+id/bordera"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="0.15" />
<ImageView
android:id="@+id/colora"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="0.15"
/>
</LinearLayout>
`
जो भी ऊपर नीचे पट्टी से कॉपी पेस्ट करें। बस android:layout_alignParentBottom="true"
से android:layout_alignParentTop="true"
तक एक चीज़ बदलें और आपको नीचे और शीर्ष पर एक क्रियाबार मिला है। इस मामले में आप अभ्यस्त ActionBar उपयोग करने के लिए तो मैं आप Theme.Holo.NoActionBar
उपयोग करने के लिए सुझाव है कि जरूरत है और यहां छवि परिणाम है: - http://i.imgur.com/N8uKg6v.png
यह एक परियोजना मैं अब पर काम कर रहा हूँ है। लगभग सबकुछ किया लेकिन अभी भी डिजाइन के साथ संघर्ष कर रहा है। आशा है कि मेरा जवाब आपको लाभ पहुंचाएगा। यदि आपको यह दिलचस्प लगता है तो कृपया उत्तर दें।
सबसे अच्छा संबंध है। ~ कोश
आप appCompat का उपयोग किया जा सकता है। एक्शनबैर कॉम्पैक्ट में यह 'android.support.UI_OPTIONS' मेटाडेटा फ़ील्ड को 'splitActionBarWhenNarrow' में प्रकट करके किया जाता है। <मेटा-डेटा एंड्रॉइड: नाम = "android.support.UI_OPTIONS" एंड्रॉइड: वैल्यू = "स्प्लिटएक्शनबारहेन नारो" /> – SAIR