ActionBar

getSupportActionBar() The method getSupportActionBar() is undefined for the type TaskActivity. Why?

匿名 (未验证) 提交于 2019-12-03 02:00:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I was recommended to extend my Activity class from ActionBarActivity Here is the previous code: import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBarActivity; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } I wrote new application and followed advice. import android.os.Bundle; import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBarActivity; public class

ActionBar Sherlock with Android Studio 0.2.2

匿名 (未验证) 提交于 2019-12-03 01:58:03
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I am developing a demo app using ActionBar Sherlock and Android Studio. Android Studio Version is 0.2.2, gradle version is 1.6 and plugin version is 0.5.1 and i am following these tutorials :- www.grokkingandroid.com showlabor.blogspot.ca i am getting following error :- Gradle : Execution failed for task ':libraries:ActionBarSherlock:actionbarsherlock:compileReleaseAidl' . tried to access class com . android . build . gradle . internal . tasks . DependencyBasedCompileTask$DepFileProcessor from class com . android . build . gradle .

Actionbar styled overflow menu items

匿名 (未验证) 提交于 2019-12-03 01:57:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I need to make fully custom overflow menu items (different background colors as minimum as showed on picture). Is it possible? 回答1: Last day i have to implement Action Bar Sherlock.And my case was same as yours. I have implement Adapter for my navigation List.Let say: public class MyNavigationAdapter extends BaseAdapter { Context mContext = null; String[] mTitles; LayoutInflater mLayOutInflater = null; public MyNavigationAdapter(Context context, String[] titles) { this.mContext = context; this.mTitles = titles; mLayOutInflater =

Custom theme in Android / Xamarin project - center Title text of Action Bar

匿名 (未验证) 提交于 2019-12-03 01:48:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I have custom theme in Android / Xamarin project. What I can't do is to: set header to the middle (and remove icon) add menu button with menu option (for example button settings) I've tried with settings property -> gravity to center but it didn't work. */ /*--> */ */ /*--> */ */ /*--> */ 回答1: You will have to do it programmatically via a static method inside a static class public static void SetActionbarText ( Activity activity , string text ) { // Setting custom view enable activity . ActionBar . SetHomeButtonEnabled ( false );

Android ActionBar tabs set initially selected tab

匿名 (未验证) 提交于 2019-12-03 01:47:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have noticed that when using actionBar.setSelectedNavigationItem(x) in the onCreate() method of my Activity, the tab item at position 0 is always selected first and then the tab item at position x is loaded. This means that (since I'm using Fragments) 2 Fragments are loaded. One of them being unnecessary... Here's my code: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); // Determine which bundle to use; either the saved instance or a bundle // that has been passed in

How to control ActionBar split programmatically?

匿名 (未验证) 提交于 2019-12-03 01:39:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: The android ActionBar may split into a top and bottom bars if activity's parameter " uiOptions " is set to " splitActionBarWhenNarrow ", note this parameter is only valid in ICS. Honeycomb has introduced a new approach to multi-select list items using action bar. When a item is under press & hold the list becomes into a multi-selection mode and the actionbar bar may be used to accomplish some actions. The actionbar setup is inherited from the list activity, i.e., if the activity has a split action bar the multi-selection will have too, and

Android getActionBar vs getSupportActionBar?

匿名 (未验证) 提交于 2019-12-03 01:33:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Here is my code: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB){ //android.support.v7.app.ActionBar actionBar = getSupportActionBar(); //actionBar.setTitle("Android"); ActionBar actionBar = getActionBar(); actionBar.setTitle("Droid"); } While using the getSupportActionBar() my app runs just fine with kitkat and other new versions but using getActionBar results into an error. Here is error: Why? From android documentations : Caution: Be certain you import the ActionBar class (and related APIs) from the appropriate package: If

SwipeRefreshLayout behind ActionBar

匿名 (未验证) 提交于 2019-12-03 01:15:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: When using a SwipeRefreshLayout in combination with a overlay mode ActionBar, the loading animation will be displayed behind the actionbar, making it almost invisible. Is there anything I can do to show it on top of the actionbar? 回答1: In the Material Design version of the appcompat-v7 library (v21.0.0), SwipeRefreshLayout gets a method to set the Progress View offset. https://developer.android.com/reference/android/support/v4/widget/SwipeRefreshLayout.html#setProgressViewOffset(boolean,%20int,%20int) public void setProgressViewOffset

Android ActionBar.Tab setCustomView() doesn't fill_parent

匿名 (未验证) 提交于 2019-12-03 01:12:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm using ActionBar.Tab setCustomView() method with this layout: this is my function setting the ActionBar: public void setActionBar() { ActionBar actionBar = getSupportActionBar(); //actionBar.hide(); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); actionBar.setDisplayShowHomeEnabled(false); actionBar.setDisplayShowTitleEnabled(false); //set action bar navigation mode actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); //set tabs //home tab Tab tab = actionBar.newTab().setText(TAB_HOME).setTabListener(new

Actionbar notification count icon (badge) like Google has

匿名 (未验证) 提交于 2019-12-03 01:04:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Is there a android standard badge or method to show action bar notification icon with a count like on Google examples? If not, then what is the best way to make it? I'm new to android, please help. 回答1: I am not sure if this is the best solution or not, but it is what I need. Please tell me if you know what is need to be changed for better performance or quality. In my case, I have a button. Custom item on my menu - main.xml Custom shape drawable (background square) - shape_notification.xml Layout for my view - feed_update_count.xml