RelativeLayout "layout_below" Using ID in another layout - android

I currently have two RelataiveLayouts in my android prototype.
I created a title id in the first layout by calling:
android:id = "#+id/title"
From another layout, I wanted to place an ImageView below the title, so I called in another layout,
android:layout_below = "#id/title"
There is no error occurring but I am not seeing it working.
Please advise me!
Thanks in advance :)
UPDATE: September 21st 2014
Okay I think I found what is wrong on the layout structure.
I use 1 actionbar layout to contain fragment layouts. But what I think is that, the layout
is more like overlayed not actually nested within the actionbar layout. That seems like why
"android:layout_below" did not work eventhough I do not get compilation/build error.
So the structure is like this:
So the title is positioned at the same place for all different tabs,
and I want to place images or text below that #id/title in the actionbar layout.
Please advise once again ! ;)

Related

Why is my Android phone layout different then my layout on Android Studio?

The layout of my MainActivity on my phone appears very differently than the layout I see on the code editor. Images are included. I am using a TabbedView. However, the problem still exists on any layout I choose (empty/tabbed).
What can I do to solve this problem?
I am concerned about the text "Hello world" in the middle, not in the top left corner. I follow this tutorial and in the tutorial it is correctly positioned.
It works as expected, because section_label TextView width is wrap_content it changes, depending on what text it displays. And the 2nd TextViews position depends on it, so it changes too. You should be able to verify this by setting various length texts in your layout editor.
For what you want to achieve, RelativeLayout is not the best choice and you may want to use i.e. LinearLayout instead, with its orientation set to vertical and layout_gravity of second TextView set to right
This is happen because you are using the RelativeLayout in the relativelayout we can arrage our views in custom position wise by the help of give the android:id=#+id/some_id like this if you want your second view is shown just below the first view then give them the property android:layout_below="#id/view1" in your second view
Please read all the documentation of RelativeLayout form this link
https://developer.android.com/guide/topics/ui/layout/relative.html

how to create custom layout in android

first sorry for my bad English, I am new to custom layout how to create custom layout like below image any one help me how to design it ,I m already search in google but i did't any solution so,please any one help me how to do that
1.TextView and a Button
2. The 2nd seems to be just a LinearLayout with android:orientation="horizontal" which has been inflated by an item layout which has an ImageView and 3 TextViews vertically. I'm sure you are getting the idea.
3.TextView and Button again
4. Same like 2nd view but inflated with just ImageView

How to make layout like google play home?

How to make layout like this? Its looks like listview with many gridviews or listview of many different layouts. I have no idea how should i make this. On scrolling its get totally changed and also it have different more button colors. Please help me if anyone have solution.
This question is so straight forward! Don't post such kind of questions before you dig and analyze.
If I'm designing this then this how I do. (This is just a sample of static design). But Google did lot's of work here and its a dynamic content.
First the parent layout will be android.support.design.widget.CoordinateLayout and there is ScrollView or NestedScrollView as child.
Then comes SearchBar. There is a separate documentation for that. Kindly go through.
Third TableLayout with 2 columns and 3 rows which holds Buttons
Fourth is custom ViewHolder with title, subtitle and button and custom CardView at bottom of the title contains ImageView and ToolBar below with Menu.
And all these cards will have its own components etc.,

Chat layout like whatsapp

Im trying to build a chat layout like whatsapp. I don't understand how they were able to place 'date' at bottom in rightmost corner of layout.
I saw their code, it uses horizontal LinearLayout in which there is
message and date side by side, but then how does the 'I love' part
of message print above date ?
Another problem is that if I use relativelayout to push date to extreme right using alignparentright = true, it expands the entire layout to match parent, which is obvious but undesirable
Please advice me on this
As sketchy as it seems, I can only see that end result being accomplished with four text views.
Name at the top, two lines for the message, and one for the date.
One message line extends all the way across and above the date, the other is below it and next to the date.
You would need to test the textview length to see how much text you can apply to it before it starts to cut off, and apply the remainder to the second message textview.
Gross.
You can try using a FrameLayout in which there is a LinearLayout at the bottom which contains the name of the sender and the message. Then, add a TextView whose layout_gravity is set to bottom|right
You can use the layout and code below to achieve the desired effect.
Source code gist
What I have used is get the width of the text + the time layout and check if this exceeds the container layout width, and adjust the height of the container accordingly. We have to extend from FrameLayout since this is the one which allows overlapping of two child views.
This is tested to be working on English locale. Suggestions and improvements are always welcome :)
Hope I've helped someone looking for the same solution.
I would recommend using the android:layout_gravity="bottom|right" tag on the date TextView. This will attempt to lay out the View as if the container was "pushing" it to the bottom and right corner.
This may or may not work for all Views. But as #codeMagic said, if you saw their code, then it should be apparent, right?

TextView's text doesn't change?

i'm facing a problem that i never came accross before:
well i successfully applyed the 3D transition between a listview and someother layout container some info about the selected item. well the probelm is: some of the textviews are displayed correctly while others display nothing, even the imageview is shown as expected...
any suggestions?
thanks in advance..
I guess you had same collision in android:name tags. Acting wierd could happen by many reasons, but one of the most liklly to happen is when you have some collision in names, I mean more views defined with same name
#+id/something definition and #id/something reference is okey
but having #+id/something twice sometimes could be a problem.
This kind of references is usually used in relative layaout when you say I want this view to be to the left (or above, or below) some other view. Then you must give a reference to other view...
I fixed this: well i don't know the exact reason but it solved the problem
i changed the textview id in the layout and it worked fine. Weird why it didn't work until this..if any one can explain it would be great^^
I have 2 text view with the same id, one of them is inside the parent layout and the other one was in the viewpager which is child of the parent layout. I changed the latter one is and the problem is solved.

Categories

Resources