i have four images in a row at the top , on click of each icon i want to change the underlaying background (image) and the controls on the layout , this way it achieves tab like structure and behavior , i want to know whats the best way to achieve this ? I think i will have four layouts each layout having one image highlighted showing that tab selected and corresponding components on layout, and will change this layout when user clicks on image.
Is this a good idea to achieve this ? or i have different solution available ?
its nice if u give me some idea about necessary features or API or layout component related code
Suggestions are welcome thanks!
That is not a good idea. You should use android's tab architecture. Here is a example at developer.android
you can change layouts by switching views to invisible and visible. but it's not a good idea when you want to change 4 layouts.
It becomes hard to maintain the code if you have 4 layouts switching.
It's better to use Tabs which will help you in preserving the state of the each layout.
Customize the tabWidget to make it look like you have 4 buttons on the top, not the tabs.
HTH.
Related
I have a use case were a user can create own buttons and give each button a label.
To display the buttons correctly i use Recyclerview with StaggeredGridLayoutManager. This works like a charm.
Unfortunately Recyclerview is not supported on Android Widget.
What do you think is the best solution to display an arbitrary amount of buttons (each button can be of different sizes) on a widget? Should I use a GridLayout?
You can find here all the layouts that are supported to use in android widgets.
Of all the supported layouts listed the one that is closer in appearance to StaggeredGridLayout is the GridLayout. So, I would pick GridLayout to start with and then depending on my design needs I would combine it with what fits my needs best. Most probably, if you want to keep StaggeredGridLayout's default appearance, maybe you can combine it with some LinearLayouts wherever needed.
I want to achive that I have a transparent background BUT with a picture !
So if got this in the XML file of my layout :
android:background="#drawable/wallpaperpic"
Now I want to transparent it so the background menu (f.ex. widgets or app menu) is seeable but also my drawable/wallpaperpic and the rest of my buttons etc are normal (100%).Hopefully I was able to express my self !
My Background : https://amazingpict.com/wp-content/uploads/2015/04/polygon-texture.jpg
I want to have this
WHERE you also can see my background picture a bit
Try to set the alpha property of the view, like:
yourView.serAlpha(10);
If, as I'm guessing now, you have two layouts, one within the other, where the parent layout has the background, you can do this in the child layout:
android:background="#null"
This way, you can see the background, and your elements are intact.
Option 1 is to convert your image to a PNG and add an alpha channel.
Option 2 (which I would recommend) is to have a separate view that acts as your background, and set the alpha property for this view only. You can use a FrameLayout to put this background view underneath your other controls.
In my opinion use TintableBackgroundView.
TintableBackgroundView.
If you launch your activity the normal way, the system will not render anything behind it (i.e. the launcher will be completely gone - it could even remove it from memory).
You'll need to implement your activity as an alert window. This answer has details on how to implement it.
I have two layouts that I want to be able to switch between using a longclicklistener in a fragment. The layouts are identical except for colors and backgrounds, and the id's for views in each of their xmls are the same, so that code can be run using both layouts the same way. I'm wondering what code to use to change these layouts. Thanks for your help.
If the two layout are the same except the background colours , you can just change the ui components background colours at runtime programmatically.
You can used ViewSwitcher view
http://developer.android.com/reference/android/widget/ViewSwitcher.html
I am new to Android development, and I am wondering if there are any samples available to create a panel similar to the photo/checkin/mood/write panel at the bottom of the google+ app on android.
1) Are they 4 buttons? How do I style the buttons to look like that?
2) I want to auto hide the panel on scroll down, but show on scroll up.
Appreciate if anyone could guide me in the right direction.
Cheers
To show\hide panel - use animation.
This panel can be linearLayout with 4 buttons.
Do detect what've been scrolled look at: Synchronise ScrollView scroll positions - android
you can use linearlayout and in that take for imageview..when scrolling you can show/hide linearlayout..and for view you can use linearlayout color as black and this imageview images..
OK, so I implemented exactly what you trying to do only without the buttons.
After lot of hours spending googling around I found this one - https://gist.github.com/imminent/4576886 by Dandre' Allison, which is a specific implantation of quick return bar for a list view which is little more trickier from other view components. For more implementations of quick return bar and other scrolling tricks you can use Roman Nurik's Scrolling Tricks library here https://plus.google.com/u/0/+RomanNurik/posts/1Sb549FvpJt and here http://www.androidviews.net/2012/11/scrolling-tricks/. I just saw that there is another quick return bar for list view implenation by Lars Werkman in https://github.com/LarsWerkman/QuickReturnListView which I never tested. I used the Dandre' Allison snippet which works great.
Answering your first question.
all the buttons are either in ImageButton, or in ImageView that make it clickable. it's either you can lay it out in LinearLayout or RelativeLayout, well it's depends on how you want to make it.
Try Using split action bar this will basically do the task for you.
Im having quite a difficult time setting up this GUI
As you can see in the picture i need to have several clickable items and i dont know how to do it. So i thought i could make one different VerticalFieldManager representing the white background. But it looks impossible to have more than two VerticalFieldManager over the main manager. So i thought i could use a LabelField and change the background color to white (it didnt work either) and on top of it put clickable labels and clickable textField but i dont get the background VerticalFieldManager to repeat it self and put itself under the previous one with a slight margin between them. Anyways, can you guys give me ideas on how to accomplish this GUI, what to use as background.
Thanks in advance and have a nice one.
I would suggest the following layout
Screen delegate should be VerticalFieldManager
Each item should be VerticalFieldManager as well
The body of the item itself should be RichTextField
The rest of the clickable elements you mentioned should be clickable Labels.
You will have to use HorizontalFieldManagers as well. One for the top panel and one for the bottom panel. Check the JustifiedHorizontalFieldManager from the advanced UI libarary.
As for clickable label - it is easy to implement one. Search SO for "[blackberry] clickable label". You can also check the BaseButtonField and BitmapButtonField provided in BlackBerry advanced UI library and available here.