How can I achieve this layout?
Use a FrameLayout that act as a parent of a LinearLayout( say layout ll_par) & an ImageView..In your ll_par add your two remaining layout .& remember put the Imageview as the last child of FrameLayout & set its layout_gravity to right|center_vertical & give some margin to your Imageview according to the need ..
Related
how can i mange Textview in layout.? please help me..
how can i set textview and border then again textview.
Just create a horizontal LinearLayout, and add an ImageView, a TextView, a View with width 2dp and height match_parent, and a TextView as children.
Either repeat that for every row, or use the recommended approach of using a ListView with the above mentioned layout as rows.
I'd use two compound TextViews: Just create a horizontal LinearLayout, and add a TextView with drawableLeft="#drawable/icon_location" and another one with drawableLeft="#drawable/line_vertical" as children.
For both, a drawablePadding="8dp" or whatever you like best
I have two relative layout say relative layout1 & 2 having an edit text and a button. In order to provide spacing in between I specified margin top of 30dp to relative layout2. Another relative layout 3 is generated dynamically in between them when we click button of the relative layout1. If so I have to remove margin top of relative layout2 programatically.
snapshot is like below
In this case a provide padding in xml. But when another layout is added in between like this
the padding is not preferable. I have to remove padding programmatically. How can i do that by checking whether there is a layout in between and remove that padding. I am a beginner in android coding....
You can set margins, or anything else regarding a layout like this:
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams)relativeLayout.getLayoutParams();
layoutParams.setMargins(80, 0, 0, 0); // left, top, right, bottom
relativeLayout.setLayoutParams(layoutParams);
You can find more Information on LayoutParams here:
http://developer.android.com/reference/android/widget/RelativeLayout.LayoutParams.html
If you want to remove padding call
relativeLayout.setPadding(0,0,0,0);
I use a relative layout. I was wondering, if I want to place a text field to the right "of the middle" of another view (say imageview). How can I do it? I always know how to place it to the right, but it seems that the middles of both views are not aligned
Thanks
Put them both in a relative layout, and set the gravity for the relative layout to center.
hi I have 2 layout inside a framelayout and i want one linearlayout at top and another at bottom where i will specify height for both the layouts
and how to set this parameter for the linearLayout "layout_gravity " by code not by XML
Use a surfaceView , the SurfaceView allows you to stack in the Z order.
Docs
make sure your surfaceView is under the views of the views you want to stack.
Hope this helps
first fetch the layout from id.
LinearLayout layout = (LinearLayout)findViewById(R.id.IDOFLAYOUT);
//the set the gravity by this method
layout.setGravity(Gravity.CENTER);
I want to layout my views in the following way: [Button] [SomeView] [Button]. I want to set specific sizes for buttons (in mm), and then have the SomeView fill the remaining space between them.
How to achieve this?
Maybe you could set the layout:weight of the [SomeView] to 1 and put all of these views in a linearlayout. Hope it works!