This is my first time when i am posting on a forum. Although i am using stackoverflow for a lone time and find it useful.
My question is that i am developing a virtual chemist laboratory! and i have to make a horizontal bar upon which different apparatus can be placed like shown in the picture. Please tell me how to achieve that
Use LinearLayout and set orientation to horizontal.
Inside this layout add images as much as you wish.
Use weightSum for linearlayout, also use layout_weight for all images.
this can be done by FragmentActivity put horizontal button in main layout and replace fragment
firstly create a fragment main layout which has two Items ur horizontal buttons and container for replace fargment then create fargments according to ur button if u have 4 button the create 4 child fragmentss *
check my project
You can instead use horizontal list view. Its just a simple list view with same adapter support to form list in horizontal orientation.
Check the link for reference https://github.com/sephiroth74/HorizontalVariableListView
Done with this problem using Linear Layout. and then using a customized border on the bottom side. Then just add horizontal scrollbar in it.
Link : https://dl.dropboxusercontent.com/u/54327753/Screenshot%202015-01-02%2022.23.17.png
Related
My Idea is adding TextViews with rounded corners background to a horizontal LinearLayout, so if next one wouldn't fit - I will add TextView to another LinearLayout below.
Is there a way to do so? I know it sound like a custom view, but I would like not to bother as much - to adjust height, make click area calculations istead of simple clickListeners
Sounds like a recyclerview using a flexbox layout https://github.com/google/flexbox-layout with flexWrap turned on.
You could also use is in a static layout as well.
With flexWrap it does all the calculations to see if the "item" can fit on a line and if not starts a new line.
Many examples on the github page.
You could keep adding text views in linear layout while checking if newly added text view is outside of linear layout horizontal boundaries, if it is you could remove it from linear layout and add it in new one but I see no reason why you would want to do that.
I would work with a piece of layout that isn't shown, the user must scroll to see what I have did. How can I do it? Can I join 2 different layout in one? I prefer to collocate item as I do with default layout. If it can help, I use Android studio. I prefer use elements without code, adding them from palette. An example :
You can use two different layout in main relative layout & whenever u want child layout just set visibility.
You will want to use a ScrollView for this. From the documentation:
Layout container for a view hierarchy that can be scrolled by the user, allowing it to be larger than the physical display.
I am interested to learn how to make this Layout (in Picture):
:
As you can see there are 2 Layouts and user can switch them with the button what is in upper right corner. Can someone learn me how to make this Layout?
I'd recommend you using SlidingMenu library.
That is exactly what you want.
It has numerous options, so you can customize the view you want to get behind.
The left menu is implemented with a library called SlidingMenu. In the sliding menu you can simply add normal layout / android ui components. So there is a ListView with items. The items are simple LinearLayouts with the correct weights, to achieve a "table like" layout.
There are two ViewTypes in the ListView. One is a normal Item, one is a section header (Linear Layout or Framelayout).
You could also use a RelativeLayout instead of LinearLayout, but Relative Layout are "more expensive" (performance) than a LinearLayout.
i think you had to customise viewpager layout .
set first layout width as u need to be shown.
sample view pager
I am using Eclipse and a ViewFlipper. In Graphical Layout, I want to see the second, third, and forth layouts of my views - right now, I can only see the first view. Any suggestions?
If I'm understanding you correctly, you want to see each view in the 'Graphical layout' tool? The way I do this, is instead of having all the layout work done in one xml (where your viewflipper is) I make each view a new layout xml. And then have each view (xml file) included into the view flipper by using this....
<include
layout="#layout/layout_media"
android:id="#+id/flipper_media" />
Hope this helps.
just put each layout in relative layout or linear what ever you are working with then with each layout you will work with the first one in the order and etc.. then at the end put each layout in the order you want later
I had to subclass the ViewSwitcher class to display an indeterminate ProgressBar until data is ready to display in the second view. I used isInEditMode() to determine whether I was actually running the app or just previewing in AS.
You should be able to add a custom attribute to choose which child to display. This might look a bit overkill, but if you happen to already have to subclass your ViewSwitcher or ViewFlipper, i think it is not a big deal.
I will try to put an example later.
In my app I want to have a button that if the user clicks it
than a new layout is opened within the current (acually the main) layout.
the new layout should not fill all of the screen and parts of the previous layout
should be grayed out.
Any ideas on how to do this ?
You can show a hidden layout within your button's onClick event by calling
view.setVisibility(View.VISIBLE)
You can also fade out view elements or whole views with
view.setAlpha(75);
view.setBackgroundColor(Color.GRAY);
Note that "view" in the first example is your layout element.. LinearLayout, RelativeLayout, etc. and in the 2nd example, "view" is the element(s) you're trying to gray out.
Follow the answer of SBerg413. And for more information. you can take the relativelayout for the part that you want to hide and display on the button click.
And as like SBerg413 answer. you can hide the respective layout and show the layout you want to display.
Hope it will help you.
Thanks.
you can use a ViewFlipper to achieve what you want, position the viewflipper where the child views should fit (part of the screen you say)..
Inflate the rest of the "child" layouts from other xml, add them to the flipper and switch between them when you want...