android-actionbar

customize action bar tabview

孤人 提交于 2019-12-21 05:54:32
问题 I am trying to create a custom tabview in the action bar, something like this: I got this view: i want to change the background of tabviews indicators, so backgroung color become invisible and we have the green line under the selected tabview indicator. Here are my code (i used default tabview): public class BaseActivity extends Activity{ ActionBar bar; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.base_activity); bar =

Replacing ActionBarSherlock With AppCompat

大城市里の小女人 提交于 2019-12-21 05:47:06
问题 I'm currently working on a simple navigation drawer + sliding tab. However, I wanted these a material design on my own app. Therefore, I have no choice except to get rid off ActionBarSherlock . When in these attempt, I found that 2 types of imports which are as follows: import com.actionbarsherlock.app.SherlockFragment; import com.actionbarsherlock.app.SherlockFragmentActivity; has to be removed too. However, more errors seem to appear after removing it. So, is there any other type of imports

Android, How to mix ActionBar.Tab + View Pager + ListFragment

ぐ巨炮叔叔 提交于 2019-12-21 05:27:06
问题 I've been trying to test how to mix all these things together and I'm having problems!! I just want an app with three tabs using the ActionBar.Tab. For example, this tabs can be movies genres Action, Adventure and Animation, the user can swipe through the tabs, so it will use the ViewPager and each tab will show a list of movies of that genre. There's no need to have three different fragments classes because all tabs will be the same format a simple list. And I'm having problems because when

Is it possible to have a action bar menu using the appcompat library?

╄→尐↘猪︶ㄣ 提交于 2019-12-21 05:15:16
问题 recently I've switched from the regular action bar implementation to the recently released appcompat implementation. My app made heavy use of the action bar to provide functionality. Since switching, on older spots APIs (less than 11) don't have any menu items. And newer APIs do, but they don't show the image like configured (if room|withText). Has anyone else experienced this or came up with any solutions? 回答1: I found out what was up, when using the appcompat library. You can create your

Actionbar logo padding left

让人想犯罪 __ 提交于 2019-12-21 05:04:52
问题 The actionbar shows a space on the left side of the logo. This space is reserved for the upindicator i think. I want to give this space a defined distance of 20dp for example. How can i do this? I can set the padding of the icon to 0, but that does not remove the space between the logo and the left side of the screen. I tried to solve it by using a custom layout. But there is a little problem. Every time the activity launches, first the normal actionbar appears and then shows the custom

Have the split ActionBar display twice as many icons

瘦欲@ 提交于 2019-12-21 04:28:18
问题 I'd like to have an app layout as the one they used for Gmail. They have the actionbar that has icons (on my device it has the app logo for up navigation, and a custom view for selecting priority inbox/inbox/etc), but there is also some kind of split ActionBar because at the bottom I have several icons (compose, search, labels, etc). How could I do this? I have implemented the following ActionBar through this XML: <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas

Action Bar Icon hidden after SearchView expands

风格不统一 提交于 2019-12-21 03:33:18
问题 I want the icon beside the SearchView (the "cloud") stays visible even when the SearchView expands. This works properly for tablets but doesn't work in case of smaller devices like Nexus 5. I have set the showAsAction="always" for this menu item. Also, the SearchView has this attribute: showAsAction="ifRoom" . 回答1: try with this, works for me using appCompat v21 final MenuItem switchButton = menu.findItem(R.id.action_import); final MenuItem searchItem = menu.findItem(R.id.action_search);

Action Bar Icon hidden after SearchView expands

落花浮王杯 提交于 2019-12-21 03:33:07
问题 I want the icon beside the SearchView (the "cloud") stays visible even when the SearchView expands. This works properly for tablets but doesn't work in case of smaller devices like Nexus 5. I have set the showAsAction="always" for this menu item. Also, the SearchView has this attribute: showAsAction="ifRoom" . 回答1: try with this, works for me using appCompat v21 final MenuItem switchButton = menu.findItem(R.id.action_import); final MenuItem searchItem = menu.findItem(R.id.action_search);

Activity with action bar but without title?

丶灬走出姿态 提交于 2019-12-21 02:56:09
问题 How to achieve this? It seems very simple, but actually it's not easy to do it in acceptable way. I tried this: 1) in AndroidManifest I set activity theme to Theme.NoTitleBar. However, in my Activity then getActionBar() method returns null => UNUSABLE 2) I hide title programatically in my activity by calling: actionbar.setDisplayShowTitleEnabled(false); actionbar.setDisplayShowHomeEnabled(false); and it helped, but there's a little delay, so I can see title bar maybe quarter of second after

Set menu item background color on hover in Android

有些话、适合烂在心里 提交于 2019-12-20 20:15:08
问题 I have menu items in my app, and I would like to change color of item background, when it is clicked (please see screenshot - item 1 is clicked) I just want one color here - either light blue, or dark one. However, as you can see, there are two of them on the first item. Here is my code: Toolbar in activity: <android.support.v7.widget.Toolbar xmlns:sothree="http://schemas.android.com/apk/res-auto" xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/main_toolbar"