i want to show two images in action bar without listing in menu.xml file
means i want to customise with image button or button and i want to set background color in action bar i want to try with onCreateActionView() this method can any one provide me deep knowledge ?
design a layout as per your need and use the code
actionBar.setCustomView(R.layout.test_action);
and u can use the buttons or images by finding its id from the action bar.
Related
I have requirement to make this kind of progress bar.
How can I archive this?
You can achieve it by making custom view , you don't have to make fully custom view (i.e extending View) you can modify existing view sub type like Button
Navigation bar vs toolbar i am trying to change my navigation bar a little bit. I want to insert a picture inside it and change the color but leave the back button there. What is the easiest way to do it? Thanks
In my application (only for my application), I want to add a button to the navigation system bar
How I can do that in my code?
You cannot do anything there. Not to mention some devices will not show this bar at all if they got hardware buttons.
You can't.
Maybe try to add a fragment that will be exactly above it.
Some phones don't even have that buttons on screen.
firstly check mobile or tab has soft buttons if has then make full screen by programaticaly after that create custum button bar like tab bar at bottom and put buttons as you like thats better if u dont have any other idea
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
I need to dynamically set the icon in the title bar. Currently I have this code in my activity:
requestWindowFeature(Window.FEATURE_LEFT_ICON);
setContentView(R.layout.table_layout_activity);
getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, R.drawable.icon_procedure);
This works fine, except that it changes the font size and it removes the (default) border line at the bottom of the bar. I'd like to only set the icon and leave everything else as default.
Default title bar:
.
Custom icon:
.
Anyone can help?
Icon can be changed in multiple ways for Activities, programmatically for an individual activity as
In onCreate()
getActionBar().setIcon(R.drawable.icon);
// icon is image in res/drawable folder.
Or in actionbar theme, by adding this to your ActionBar style.
<item name="android:icon">#drawable/icon</item>
<!-- This changes icon universally for all Activities in application -->
Since you are using the action bar, use setIcon() on ActionBar to change the icon, and get rid of that other stuff.
Use setIcon() on actionBar() or change it directly in androidManifest.xml
Is there a way to make radio buttons do nothing when they are clicked? I am trying to make a Score Board and need a way to show the periods/halves/quarters ect. The radio buttons will be selected by the program to display periods/halves/quarters ect. Is this a good way to do it or is there a better way?
Check out the clickable attribute for Views
Defines whether this view reacts to click events.
Must be a boolean value, either "true" or "false".
http://developer.android.com/reference/android/view/View.html#attr_android:clickable
If the user doesn't ever need to click the radio buttons (ie if its always controlled by the program), why don't you just use images instead of radio buttons.
The benefits of using images for this are...
Images aren't clickable by default
It'll look nicer (you can make the Images look like a real scoreboard)
It doesn't rely on the default Android appearance (which is different for each phone)