android-actionbar

RelativeLayout/customview doesn't fill tab's width

自闭症网瘾萝莉.ら 提交于 2019-12-13 14:25:11
问题 I'm trying to fill a tab with a view. For more information about the exact thing I try to achieve with the view please read my previous question : How to customize individual tabs? (changing background color, indicator color and text color) The result I got now is this : As you can see the tab is not completely filled with the view in its width. my layout xml : <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout

How to disable Action bar tab for fragments?

假装没事ソ 提交于 2019-12-13 14:12:36
问题 As i am using Action bar 3 tabs with fragments A,B,C want to disable B,C initially i am using ActionBar.Tab tab2 = ab.newTab(); tab2.setText("PORT"); tab2.setTabListener(this); tab2.setEnable(false); but not allows me to use tab2.setEnable what is exact way to disable it? 回答1: You have to remove a tab from the actionbar. Enable or disableing tabs is not supported. There is also no visibility function for tabs. You have to call: ab.removeTab(tab2); to remove a tab from the actionbar. But that

How can I change option menu in different fragments?

三世轮回 提交于 2019-12-13 12:57:40
问题 I have a Fragment with menu: public class FragmentA extends Fragment { public FragmentA() { setHasOptionsMenu(true); } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ... setHasOptionsMenu(true); } @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.activity_main_actions, menu); super.onCreateOptionsMenu(menu, inflater); } } I would like to change menu but it doesn't work and keep the old action

How to find out the String ID of an item in the Menu knowing its decimal value?

一世执手 提交于 2019-12-13 12:08:30
问题 I am using android-support-v7-appcompat. In an activity I want to show in the actionbar the back button. I do: public class News extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.act_news_screen); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(false); } } And: @Override public boolean onOptionsItemSelected(MenuItem item) { System.out

How to add Search View on Action bar on one of the fragments in tab layout dynamically?

不想你离开。 提交于 2019-12-13 11:04:14
问题 Please provide me a better solution if you have I am working on android app in which on home Activity by using TabLaout&ViewPager i have added 5 tabs on below Home Social Notice Search Links I have set for MainActivity in values/style but i have placed custom action bar tag in search.xml. I know how to add SearchView on action bar in activity but i am facing issues using fragments. My goal is just to show search view widget on action bar when user will on "Search" tab. On other tabs i don't

SearchView positions when expanded in ActionBar

北城以北 提交于 2019-12-13 09:23:18
问题 1.how can i get SearchView left,right,bottom,.. positions when it is expanded in Action Bar,and i am getting the values in normal position. 2.how can give my list of words as search suggestions for a searchview. 回答1: You can use android:layout_centerInParent="true" to put searchview in center <item android:id="@+id/action_search" android:layout_centerInParent="true" android:actionViewClass="android.widget.SearchView" android:icon="@drawable/search_main" android:iconifiedByDefault="false"

You need to use a Theme.AppCompat theme (or descendant) with this activity on Android

岁酱吖の 提交于 2019-12-13 09:22:45
问题 I have this in Activity : public class MainActivity extends AppCompatActivity implements FragmentDrawer.FragmentDrawerListener{ private Toolbar mToolbar; private FragmentDrawer drawerFragment; private RecyclerView recyclerView; private IsAdapter isAdapter; private List<Is> isList; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mToolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar

How to Padding between ActionBar's menu items icon When using the Support Library,

陌路散爱 提交于 2019-12-13 09:14:22
问题 I used the action bar support library and have to adjust Padding between ActionBar's menu items icon. Please help. 回答1: You have to override the style of the action bar. You can change as your requirement. <style name="CustomActionBarTheme" parent="@android:style/Theme.Holo.Light.DarkActionBar"> <item name="android:actionBarTabTextStyle">@style/TabTextStyle</item> <item name="actionBarTabTextStyle">@style/TabTextStyle</item> <item name="android:scrollHorizontally">false</item> <item name=

Center align right aligned button on Action Bar

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-13 08:48:17
问题 I have added a button to the Action bar but now it is aligned to the far right like this I want to align that button to the center like this. How can I acheive this? Is there a way to do it without creating a custom Action bar? This is the current layout of the Action bar. The button in question is the first <item> . xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:id="@+id/post_your_notice" android:background="

Not able to get the overflow feature for actionbar in android

谁都会走 提交于 2019-12-13 07:47:26
问题 What i am trying to do :: What is happening :: My code :: actionbar_sort_menu.xml <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" > <item android:id="@+id/searchID" android:icon="@drawable/ic_action_search" android:showAsAction="ifRoom|withText" android:title="Search"/> <item android:id="@+id/featuredID" android:icon="@drawable/ic_action_featured" android:showAsAction="ifRoom|withText" android:title="Featured"/> <item android:id="@+id