I am using ABS for my application. But I do not want my start screen (the first activity) to have action bar. How should I modify the theme to achieve this?
Many thanks in advance.
You could set your activity's theme attribute in AndroidManifest.xml file to one of the following based on your requirement:
android:theme="#style/Theme.Sherlock.Light.NoActionBar"
android:theme="#style/Theme.Sherlock.NoActionBar
call hide() on your ActionBar object, inside the onCreate() of your FirstActivity
if you are using Sherlock
getSupportActionBar().hide();
add following code in your activity :
ActionBar ab = getActionBar();
ab.setDisplayShowTitleEnabled(false);
ab.setDisplayShowHomeEnabled(false);
ab.hide();
Related
I have tried to do some research on the topic and I am attempting to add an on-click listener for a button in a fragment in the main activity. So when I click a button in a fragment the click can get registered in the main activity file.
You can use custom broadcast receiver
You will register a receiver on button click in fragment
Then in activity apply action if this broadcast action equal to this custom action
you can use interface for this problem
How to change the title bar inside a fragment? Somewhat I am not able to succeed.
setTitle("My new title");
getActionBar().setIcon(R.drawable.my_icon);
I think the problem is that you can't access the ActionBar APIs from the fragment. So, what you need is an access to the Parent Activity.
Try : getActivity().setTitle("My new title");
How to get ActionBar onClick listener? I mean- global listener for whole view, not only ActionBar child views
Try to use a custom view.
Create the layout you want for your action bar
Add the android:onClick attribute in the xml
android:onClick="handleClick"
inflate it somewhere in your code
use ActionBar.setCustomView() method
Implement the onClick method in your Java
public void handleClick(View view) {
// code after click here
}
That should work !
I want to add a a menu item to the top (Where the class title is). I added the item to menu.xml and also for made an Intent to open a new class after clicking but it does not open my whole app anymore. And when I remove android:onClick:"history" it starts working again with out the menu function of course.
Have a look at the picture please: http://snag.gy/udxXc.jpg
That 'History' is my button that needs to open a new class. and this is my code:
xml:
<item
android:id="#+id/history"
android:showAsAction="always"
android:title="History"
android:onClick="history"/>
Java:
public void history(View view){
Intent historyIntent = new Intent(this, History.class);
startActivity(historyIntent);
}
Am i doing it correctly? or any better solution?
I want to add a a menu item to the top (Where the class title is)
That is called the action bar.
And when I remove android:onClick:"history" it starts working again with out the menu function of course.
I am not aware that android:onClick is valid for <item> elements.
Am i doing it correctly?
Not as far as I am aware.
or any better solution?
Override onOptionsItemSelected() and respond to the item click there.
How will it be possible to have a menu button which call option-menus with the following condistions ( must be ):
App hides the titlebar :
requestWindowFeature(Window.FEATURE_NO_TITLE);
the targetversion in Manifest is set to 16 :
android:targetSdkVersion="16"
Some Infos and researches from my side:
Setting targetSdkVersion="10" shows the menu still in the bottom, which I would like to achieve.
Showing the titlebar shows the menubutton in top ( 3 points icon ) and the menu is also callable. But I need to hide the titlebar.
any hints , suggestions ?
thanks & regards
Andreas
Another option is to use slider menu and have it on left or right. You shouldn't include button on action bar (like facebook), you can open menu after item click or onFling event.
There is nice and easy tutorial that I tried:
http://oodlestechnologies.com/blogs/Facebook-Style-Slide-Menu-In-Android