android-actionbar

How to get a label in the Android action bar

守給你的承諾、 提交于 2019-12-12 02:36:32
问题 As the title suggests, I want to put some text in the action bar. Firstly, here's a mockup (in Paint!) of what I'm imagining: I'm really struggling with this. In my activity I put: @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main_screen, menu); return true; } And in the menu folder I put main_screen.xml: <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" > <item android:id="@+id/user_level"

Transparent action bar not being fully transparent. (Leaves weirdbox)

橙三吉。 提交于 2019-12-12 02:35:58
问题 I've tried setting the action bar I custom-made for my application to be transparent. However instead of being completely transparent, it leaves a weird elevation shadow: http://puu.sh/rdYyb/04ce0147f6.jpg The XML for the bar: <android.support.design.widget.AppBarLayout android:id="@+id/appbarlayout" android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/AppTheme.AppBarOverlay"> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout

setting menu item's title appears as all cap on android

纵然是瞬间 提交于 2019-12-12 02:29:48
问题 I have a menu item as explained in How do I add a button as a menu item?. When I use an icon, I can click on the icon fine. But when I use an actionLayout , I am getting no response on click. Here is the button the actionLayout points to: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" > <Button android:id="@+id/my_btn" android:layout_width="wrap_content"

findFragmentByTag() returns null only on the third tab of the ActioBar

自古美人都是妖i 提交于 2019-12-12 01:53:16
问题 I am using a tabbed Activity provided by Android with android.support.v7.app.ActionBar.TabListener , ViewPager and FragmentPagerAdapter . The parent Activty cointains and manages three Fragment . In addition, the parent Activity has a method to save the data provided by the fragments. In order to get the data defined in them (and not sended by the parent Activity) I am wrote the following code: MyFragment frag = (MyFragment) mSectionsPagerAdapter.getActiveFragment(mViewPager,1

Action Bar items not Showing

徘徊边缘 提交于 2019-12-12 01:43:58
问题 I have inflated my action bar and created items. They show in the overflow but when I try to add code and make them show with yourapp:showAsAction="ifRoom", it gives me errors. Here is my main.xml: <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:yourapp="http://schemas.android.com/apk/res-auto" > <item android:id="@+id/action_settings" android:orderInCategory="100" android:showAsAction="never" android:title="@string/action_settings"/> <item android:id="@+id/home"

Can I embed scrollable tabs inside the action bar?

丶灬走出姿态 提交于 2019-12-12 01:29:36
问题 I'd like to have a layout where screen real estate is important on smaller screens, but I'd like users to be able to swipe between exactly two tabs. On these smaller screened devices, I don't want to waste an entire row with a scrollable tab widget like this: but fixed tabs offer no indication to users that they can swipe: Users will typically need to view both tabs to complete the task. Is there any way presently to embed tabs with support for "swipe to switch tabs" inside the main action

Android : Hiding action bar in fragment

自作多情 提交于 2019-12-12 01:28:34
问题 I have 2 Fragments mainFragment and childFragment . I want to show actionbar in mainFragment but wants to hide in childFragment . All is working fine except that when I comes back to mainFragment from childFragment and again goes to childFragment action bar shows for seconds before get hidden .. I don't know why ? HELP In childFragment I am doing this @Override public void onResume() { super.onResume(); ((ActionBarActivity) getActivity()).getSupportActionBar().hide(); mainActivity

How to enable the home button to return to a common activity?

陌路散爱 提交于 2019-12-12 01:22:50
问题 I use ActionbarSherlock and would like to enable the home button ... Therefore I call setHomeButtonEnabled(true) in my base activity. public class BaseFragmentActivity extends SherlockFragmentActivity { @Override protected void onCreate(Bundle savedInstanceState) { setTheme(R.style.Theme_Sherlock); super.onCreate(savedInstanceState); getSupportActionBar().setHomeButtonEnabled(true); // Here } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case

android - Set switch button into action bar with showAsAction=“never”

被刻印的时光 ゝ 提交于 2019-12-12 01:22:22
问题 I want to put a switch button into MenuItem with showAsAction="never" but it's not working. Here is my layout <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" tools:context="com.trietnhm.multipleactivities.MainActivity" > <item android:id="@+id/action_about" android:orderInCategory="0" app:showAsAction="never" android:title="About"/> <item

ToggleButtons as actionBar custom view behaving weirdly.

允我心安 提交于 2019-12-12 01:11:02
问题 Firstly, my code for setting up the actionBar. (Using default system actionBar, android 4.2+) @Override public boolean onCreateOptionsMenu(Menu menu){ getMenuInflater().inflate(R.menu.listing_group, menu); MenuItem listItem = menu.findItem(R.id.action_list); ToggleButton customActionIcon = (ToggleButton) getLayoutInflater().inflate(R.layout.custom_action_bar_icon_view, null); listItem.setActionView(customActionIcon); customActionIcon.setTextOff("LIST"); customActionIcon.setTextOn("LIST");