android-actionbar

Change the text color of the activity title

为君一笑 提交于 2019-12-08 14:00:02
问题 In Xamarin, how can I change the text colour of the text in the ActionBar ? I have changed the background colour successfully, but not the text colour. Here is my code: ColorDrawable colorDrawable = new ColorDrawable(Color.White); ActionBar.SetBackgroundDrawable(colorDrawable); this.TitleColor = Color.Black; I cannot see a correct method in the ActionBar object, and specifying this.TitleColor does not work correctly. 回答1: did you try this? int actionBarTitleId = Resources.getSystem()

How to set the title of action bar in center in Android

早过忘川 提交于 2019-12-08 13:30:57
问题 Hello I am working on demo app where I need to set the title in ActionBar in center of it. I have tried some posts of SO that did not work for me. I am trying on Android 4.3 phone. https://stackoverflow.com/a/21770534/2455259 , https://stackoverflow.com/a/19244633/2455259 but nothing worked for me. Is there any way to set the title of ActionBar to center in Android using appcompat ? I am doing this like below but still title is in left side. center_action_bar_title.xml <?xml version="1.0"

Why is the back arrow in the toolbar not shown?

◇◆丶佛笑我妖孽 提交于 2019-12-08 13:04:34
问题 My Problem is about the android toolbar. I want to activate the back arrow, to go back to the main menu. I used the expression getSupportActionButton.setDisplayHomeAsUpEnabled(true) . When I tested the app, the arrow was not shown. I couldn't find any solutions to solve my problem. When I used the getSupportActionButton.setDefaultDisplayHomeAsUpEnabled(true) -expression, I got the error ActionBar.setDefaultDisplayHomeAsUpEnabled can only be called from within the same library group (groupId

Android items move from ActionBar to options menu when changing orientation

二次信任 提交于 2019-12-08 11:40:48
问题 I have a fragments based app where some fragments have additional actions that I want to put as buttons into the ActionBar , while some do not have any such actions. I have created an xml menu file that contains all the items for all the fragments and I show/hide at runtime depending on which fragment is currently shown using a combination of: MenuItem item = menu.findItem(some_id); item.setVisible(false); MenuItem item = menu.findItem(some_other_id); item.setVisible(true); The problem is

How to always show overflow menu (ActionBar) even if phone has hardware menu button?

╄→гoц情女王★ 提交于 2019-12-08 11:18:35
问题 Following mentioned are codes implemented. Please suggest me how to create the "overflow menu" option in action bar even if a phone have the hardware menu button? This is my current code: MainActivity.java public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.activity_main_actions, menu); return super.onCreateOptionsMenu(menu); } activity_main_actions.xml <?xml

SherlockActionBar with AutoCompleteTextView and other items

≡放荡痞女 提交于 2019-12-08 10:55:49
问题 I want to have an action bar with AutoCompleteTextView(Collapsible) as a menuItem along with other menuItems like Delete . I am using SherlockActionBar's library to make it compatible with lower version(like 2.2, 2.3) . My requirement is to display a searchIcon (for collapsible AutoCompleteTextView) at extreme right of the actionBar and a delete icon to left of above mentioned searchIcon. Now when user taps on searchIcon, it should expand itself to cover the entire actionBar (hidinig delete

Android Activity with transparent background and Action Bar?

眉间皱痕 提交于 2019-12-08 10:38:23
问题 im trying to build a Popup for my Android App. It should be a Activity which doesn't use the whole screen, just 200dp on the right side of the screen and the rest should be transparent black. A Picture of what it looks like / what i want to have: http://i.stack.imgur.com/6APy6.png Java: public class ActivitySettings extends BaseActivity implements View.OnTouchListener { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout

How to add UI tabs in this new ICS world?

冷暖自知 提交于 2019-12-08 08:59:13
问题 I've a requirement to show tabs in an app. I've actually never used TabHost etc before, and the docs suggest the whole thing is a mess. TabActivity has been deprecated. I can't easily use it anyway as I'm using ActionBarSherlock so I cannot inherit from it. Then of course as of ICS, I'd not use a TabHost anyway, I'd use tabs on the Action Bar. As my tabs are just text and are simple in nature I see three options: Kick TabHost into working with ActionBarSherlock. It'll look pig ugly on ICS

How to update the Drop-down Navigation title when user selects an option?

╄→尐↘猪︶ㄣ 提交于 2019-12-08 07:10:39
问题 I have a Drop-down Navigation (Spinner) in my Action Bar. For creating the spinner, I used the code below, on my onCreate() method: //SPINNER SpinnerAdapter mSpinnerAdapter = ArrayAdapter.createFromResource(this, R.array.main_options, android.R.layout.simple_spinner_dropdown_item); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); getActionBar().setListNavigationCallbacks(mSpinnerAdapter,this); main_options is a array in strings.xml resources, and has 3 options, which are shown on

How to make ActionBar and stacked bar share same background image

若如初见. 提交于 2019-12-08 07:02:50
问题 is it possible for actionbar and it's stacked bar(one that contain navigation tabs) to share same background image? one that starts from actionbar and ends at stacked bar? currently the way am implementing this, am ending up having action bar with it own image and stacked bar with its own. my styles.xml <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <!-- Customize your theme here. --> <item name="android:actionBarStyle">@style/MyActionBar</item> <item name="android