How to change the location and size of Action Buttons? - android

I have a problem with the design of my ActionBar.
The problem is that I want to create an Action Button on my Action Bar that is a text only button an then I want move it around with margins and make the text bigger then the default (Not programmatically).
I tried to achive this using a style but it did not work and the size and the location of the botton stayed as the defalut. How can I achive this kind of result?

Related

What would be a good way to show activity title without actionbar?

Im making an app for android, without actionbar.
What is best practice for showing titles without actionbar?
The best practice is basically never using an action bar. This gives you a complete device screen to play with.
You can use images or different text styles for showing the title. You can also use interesting icons.
To remove action bar -
Go to res > values > styles.xml
Here is an illustration of styles file -
You can use the Toolbar (it's like the action bar, but more flexible). For example, action bar needs to be on top of the screen, but toolbar can have place anywhere in the layout.
You title can be shown as text or a beautiful asset.
If, for some reason, you don't want to use the toolbar, you can think about something like having a scrollView with the title on top of it.
Use a regular LinearLayout with a TextView inside. Style according to your needs, and set the text in the xml, or programmaticaly using TextView's setText() method.

how to put text on floating action bar (fab) in android, let the action bar be cart and text be number of items

Screenshot from Bigbasket App
I have achieved same thing by custom layout. But is there way we can put text above fab provided by android.
The FloatingActionButton extends ImageButton, which does not support text.
If you want to achieve the effect in your link using the native FloatingActionButton, you'll need to create a different icon for each digit you want to represent.
Add a textview and make it above the floating action button at centre using relative layout params and elevation attribute. You need to check for click of both I guess.
You can see this answer for elevation attribute.

How does Twitter app make both title and icon clickable in ActionBar?

I've been wondering about this question quite long time. How do they do that? Is the title just disabled and the HomeAsUp button is custom and contains the logo, arrow and text?
Do you know any other ways how to accomplish this?
You can achieve this by making a single image that contain both
- arrow.
- text.
- icon.
And the work on this single image action

Android: highlighted navigation buttons at the bottom of the screens, Split Actionbar?

Many apps (Instagram for example) have these navigation buttons at the bottom of the screens for switching activities. A button is highlighted AFTER clicking and stays highlighted during the activity until the user switches to other activities.
I'm trying to implement these buttons in my app. Are these buttons part of the split action bar, or tabs placed at the bottom, or just regular image buttons in a group (like push-buttons/radio-buttons)? I tried using split action bar. It works well, however, I cannot figure out how to highlight or change the background of the button which was clicked. I searched but couldn't find a solution. There are postings about changing the background color of the action bar item using custom selector, but it only applies to the time the button is pressed. Since so many apps these days have these buttons, I believe there are must be solutions that I'm not aware. Please help! Thanks.
try to use the tabwidget for highlighting the tab(or)button for switching in bottom

How to make home button hug the left side of the action bar

I'm using ActionBarSherlock and have set an icon using android:logo in my theme. I'd like for the icon to be flush with the left side of the screen, but it always has 6px of spacing (measured using the hierarchy viewer). I've highlighted in red the part of the icon that I can't get rid of. If I set DISPLAY_HOME_AS_UP for the action bar, then the up affordance is shown as in the second image with no additional spacing.
I assume the spacing is there to keep the icon in the same place regardless of whether the up arrow present. I'm never going to show the up arrow, so I rather have the icon flush on the left.
You can set customView like this:
actionBar.setCustomView(R.layout.customActionBarLayout)
and create your own layout just as you like it

Categories

Resources