में एक्शनबार के बाईं ओर पोजिशनिंग मेनू आइटम, मैं कुछ मेनू आइटम को हनीकॉम के एक्शनबार के बाईं ओर रखना चाहता हूं, लेकिन यह नहीं दिखाता कि यह कैसे करना है। ऐसा लगता है कि यह संभव होना चाहिए क्योंकि संपर्क ऐप ने नेविगेशन बार के तत्काल बाईं ओर खोज की है। मेनू आइटम को बाईं तरफ सेट करने के तरीके के बारे में कोई विचार?हनीकॉम
Q
हनीकॉम
31
A
उत्तर
16
एक्शनबार में एप्लिकेशन आइकन और नियमित एक्शनबार आइकन के बीच कस्टम लेआउट के लिए समर्थन है। उदाहरण:
// Set the custom section of the ActionBar with Browse and Search.
ActionBar actionBar = getActionBar();
mActionBarView = getLayoutInflater().inflate(R.layout.action_bar_custom, null);
actionBar.setCustomView(mActionBarView);
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
15
यहाँ
क्या एक सपने की तरह मेरे लिए काम करता है:
//hiding default app icon
ActionBar actionBar = getActionBar();
actionBar.setDisplayShowHomeEnabled(false);
//displaying custom ActionBar
View mActionBarView = getLayoutInflater().inflate(R.layout.my_action_bar, null);
actionBar.setCustomView(mActionBarView);
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM)
my_action_bar.xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/turquoise">
<ImageButton
android:id="@+id/btn_slide"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:background="@null"
android:scaleType="centerInside"
android:src="@drawable/btn_slide"
android:paddingRight="50dp"
android:onClick="toggleMenu"
android:paddingTop="4dp"/>
</RelativeLayout>
आप कैसे तय करते हैं कि कस्टम गतिविधि में मैं इस राशि एक्शनबार में क्लिक किया गया था? – CACuzcatlan
मैंने कोशिश की लेकिन यह अब मेरा घर आइकन नहीं दिखाता है। – CACuzcatlan
@CACuzcatlan, actionBar.setDisplayOptions (ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME) का उपयोग करें; –