how to create custom layout in android - 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

Related

Can we actually create 2 drawableLeft in android?

I was wondering if there is a way using which we can create 2 drawableLeft in our android layout. I have a scenario where i need to use 2 drawables. Anyone with any suggestions, drop them down please.
Edit: This is the layout that i want to design.
If you are using this view in only one place then you could just use LinearLayout with horizontal layout. and place 1 ImageView, TextView or Spinner [as per your requirement if the country code is selectable then you should use spinner instead of TextView for country code view] TextView and style them as needed. As in following picture:
If you need to use this layout in multiple place you could implement Custom View with the same layout file. Check how to create Custom View from this answer.

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

RelativeLayout "layout_below" Using ID in another layout

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 ! ;)

How to show and hide layout dynamically

I want to make layout that expands dynamically, like some kind of menu.
It should look like this
http://imageshack.us/photo/my-images/845/dialog.jpg/
Step 1:
When I click on TextView it should inflate the new layout, remove transparent one, and move text to the left side.
Step 2:
When I click again on TextView (it's vertical custom TextView btw) it should go back to Step1
I want to put this layout into custom dialog and it should always be on my right side of the screen?
Any ideas how to solve this?
I can do this with two layouts and changing contentView of dialog on every click, but it seems like a very dirty solution. Is there some nice and fancy way to do this?
The simplest solution is probably just inflating all the Views, set their visibility accordingly, and move the TextView when the user clicks on it.
From the looks of it, it seems like you want to slide between a lot of views by clicking the TextView? If so, you might want to look into something called ViewPager, with a little customization you might be able to archive that.
Create two different layout's mentioned in images like 1) layoutone.xml 2)layouttwo.xml
Now crete on linearlayout in add that layout in your alertdialog. Also add layoutone in that linearlayout by inflating that layout. Now on click of that textview just removeallviews from that linearlayuout & inflate second layout & vice varsa.

Android: How can I create a layout within a layout ?

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...

Categories

Resources