relativelayout

How to use the merge tag for a RelativeLayout root?

两盒软妹~` 提交于 2019-12-10 19:01:52
问题 I have a custom view which extends RelativeLayout and has its content defined in a xml file (has RelativeLayout as its root). How can I avoid having two RelativeLayouts after the inflation of my custom layout? I tried using the merge tag as my root at the xml, but that way I'm losing all my child views structure. 回答1: I tried using the merge tag as my root at the xml, but that way I'm losing all my child views structure. I doubt that. The merge tag works with no problems, you just need to use

Change TextView's position dynamically using java in RelativeLayout android

[亡魂溺海] 提交于 2019-12-10 18:54:32
问题 i have RelativeLayout, and there is a textview in the RelativeLayout, i am getting position from server like ALIGN_PARENT_LEFT, ALIGN_PARENT_TOP, based on that value i want to change position of textview... My xml file is.... <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/white" android:id="@+id/relativelayout" android

How to create column-like layout for ListView rows?

我只是一个虾纸丫 提交于 2019-12-10 18:15:14
问题 I have a relative layout which looks like this: Here is the code: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:id="@+id/nameText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="5dip" android:layout_alignParentLeft="true" android:text="Symbol" /> <TextView android:id="@+id/priceText" android

How to fill the remaining space between two layouts

心已入冬 提交于 2019-12-10 16:33:01
问题 I've got a problem concerning android layouts. In my xml file I have two relative layouts. One is attached to the top by android:layout_alignParentTop="true". The other one is attached to the bottom by android:layout_alignParentBottom="true". Now there's a lot of space between these two views. I'd like two fill this remaining space with a FrameLayout where a couple of different fragments should be displayed. Does anybody know how to fill the space I described? Thanks a lot! 回答1: <FrameLayout

How to anchor a button at the bottom of a relative layout in android

醉酒当歌 提交于 2019-12-10 13:49:57
问题 I'm new to the layout structure in android and I'm tasked with building an activity that has a button at the bottom (centered horiz as well) with a small bit of padding between the bottom of the button and the bottom of the visible screen. The challenge is how to do this in relative layout and make it anchor to the same spot regardless of screen size If anyone can point me in the right direction that would be great! 回答1: The dev docs have some sample layouts and the API Demos project is great

Dynamically add view to the bottom of RelativeLayout

坚强是说给别人听的谎言 提交于 2019-12-10 13:49:27
问题 I have in main.xml TitlePageIndicator and ViewPager, and I want to add admob (right into LinearLayout) at the bottom of RelativeLayout. How can I do this? When I launch it, the log says nothing about errors (since there is no place to put admob), but admob is invisible, I can`t see it. (looks like admob is outside the screen because I tried to set specific sizes to ViewPager and it works perfect) I do not want to set specific sizes to ViewPager (becouse of the different screen sizes) Thanks.

How to add fragments programmatically in relativelayout

北慕城南 提交于 2019-12-10 12:47:31
问题 I have designed a RelativeLayout. I am trying to add fragment to it. It overlaps. What do I need to do so that it comes one below other. FragmentTransaction t = getSupportFragmentManager().beginTransaction(); FragmentTest myFragment = new FragmentTest(); t.add(layout.getId(), myFragment, "myFirstFragment"); FragmentTest myFragment2 = new FragmentTest(); t.add(layout.getId(), myFragment2, "mySecondFragment"); t.commit(); //Views of myFragment and myFragment2 overlaps even though I have set the

Layout Resize when keyboard appear (ScrollView)

喜你入骨 提交于 2019-12-10 12:23:53
问题 I want to maintain the screen size in Layout when the keyboard appears, my idea is obtain the next in both cases (with or without keyboard): |-----------------| | image | | | |-----------------| | | | center lay | | | |-----------------| | | | image | |-----------------| But in the center layout I have some EditText and when the soft KeyBoard appear, the center layout reduce its height and is shorter, causing the first EditText sticking to the picture above. I tried several forms, for example

Margin/Padding Shrinks ImageView

為{幸葍}努か 提交于 2019-12-10 11:27:17
问题 I recently tried to position an imageview's x and y coordinates with no luck, it seems there is no way to do it in Gingerbread. I then decided to try out paddings and margins, but when I set them, it shrinks my imageview. I set a left padding of 250dp and image view became tiny. The layout_height and width are set to wrap_content. I'm not sure what's going on. Does anyone know why setting a padding/margin would shrink an imageview? 回答1: You're confusing margin and padding. Margin is the area

Android - LinearLayout in ScrollView in Relativelayout

坚强是说给别人听的谎言 提交于 2019-12-10 10:13:58
问题 I have a little problem with layouts. I have made RelativeLayout in which I put two LinearLayouts (1 and 2) and between them ScrollView with LinearLayout. Next I set that ScrollView to be placed under linearLayout2 and above linearLayout1. But LinearLayout inside that ScrollView isn't set as it's parent. Here's the code, maybe I've made a mistake: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content">