Questions tagged [fill-parent]

FILL_PARENT (renamed MATCH_PARENT starting Android API Level 8), is a constant describing that a view would like to be as big as its parent (minus any padding).

FILL_PARENT (renamed MATCH_PARENT starting Android API Level 8), is a constant describing that a view would like to be as big as its parent (minus padding). It can be used for both width and height. It is the opposite of WRAP_CONTENT, which indicates that the view wants to be just big enough to enclose its content (plus padding).

Both constants are part of the ViewGroup.LayoutParams class, from which all other LayoutParams derive, and aid in ensuring that Android applications can display properly across a variety of device screen sizes and densities. The equivalents in XML share the same names, but all lowercase.

The sample below describes a LinearLayout that vertically stacks a TextView and Button. The LinearLayout requests to be sized as big as its parent by means of android:layout_width="match_parent" and android:layout_height="match_parent". The two child views, however, are requested to limit their width and height to their contents using the wrap_content values.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:orientation="vertical" >
    <TextView android:id="@+id/text"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="Hello, I am a TextView" />
    <Button android:id="@+id/button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Hello, I am a Button" />
</LinearLayout>
73 questions
0
votes
1 answer

Problems with android GridLayout

I have two questions about my GridLayout. Why does the layout extand past the phone when I have said to fill parent, and parent is set to match parent? Why is the third textview (the one that says "Date") getting mumped down? There is a big space…
abalter
  • 9,663
  • 17
  • 90
  • 145
0
votes
3 answers

Android: fill relative layout height (item layout) inside ListView

I'm not able to make a View that fill the height of a RelativeLayout, which is the layout of ListView items. Here is my layout:
user1709805
  • 2,028
  • 3
  • 19
  • 26
0
votes
3 answers

ImageView use parent layout height

I'm having the same problem as this question but the answers there don't solve the problem. I've subclassed ImageView, and overriden onMeasure like so: @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec){ …
cmike
  • 51
  • 6
0
votes
2 answers

android - add a view which fills the screen height

I want to programmatically add a View to mainHolder that is declared as below:
Soheil
  • 1,676
  • 7
  • 34
  • 65
0
votes
2 answers

adapt bottom menu to all screens

I have designed one bottom menu in mu android app it works fine in the screen which I work on but if I change the screen , it doesn't fill all the width of screen even if I set width of the relativeLayout to fill_parent here is the code of the menu…
begiPass
  • 2,124
  • 6
  • 36
  • 57
0
votes
1 answer

AChartEngine - GraphicalView always match parent

I created a GraphicalView (a CombinedXYChartView) and added it to my layout. At next, I would like to add some CheckBoxes below my GraphicalView. The problem is, that the GraphicalView always match parent and that's why I can't see my CheckBoxes…
Namenlos
  • 1,615
  • 2
  • 18
  • 24
0
votes
1 answer

expandablelistview getchildview display incorrectly

I'm new to android, I'm now trying to use ExpandableListView to list firstly work types in group level then work items in child level. But it's very strange that layout fill_parent not work in getChildView method, it just act like wrap_content, and…
Jeff
  • 1
  • 2
0
votes
1 answer

android: how to fill a relativelayout ( screen size) with many textviews created dynamically?

I tried to use below code, but the textviews do not change line after it reach the end of screen. RelativeLayout ll = (RelativeLayout)findViewById(R.id.viewObj); int lastid=0; for (int i=0; i<100; i++) { String teststr = " hello…
manhon
  • 683
  • 7
  • 27
0
votes
1 answer

Fill up the empty space of a FlowLayout on Android

I'm creating an app which has a flow layout. The FlowLayout implementation I found from the web (I don't remember exactly from where). Now, when my layout width greater than sum of the widths of its children, I need to fill the empty space, giving…
Karlen Kishmiryan
  • 7,322
  • 5
  • 35
  • 45
0
votes
2 answers

Fill a block element with left most floating child (float: right)

I need to fill a
  • width element with his most left child (out of three childs). Those three childs are formated with display: inline-block; float: right. what i achieved so far: what i expected to achieve: It's obviously that width: 66% don't…
  • SYNCRo
    • 450
    • 5
    • 21
    0
    votes
    2 answers

    Android TextView fill_parent

    I need to build a layout similar to the following: The three rows in the left are TextViews, whose total height is unknown at the beginning. The element in the right should be any widget that can change its background color dynamically. And it…
    thameera
    • 9,168
    • 9
    • 37
    • 38
    -1
    votes
    4 answers

    How can I get an ImageView to fill parent on a relative layout?

    I am attempting to stretch a 300x300 image to fill the parent as a background for a sample layout. However, it seems that at most it can reach it's max dimensions as a perfect square. Here is my code.
    Tim Slim
    • 29
    • 1
    • 3
    -1
    votes
    1 answer

    Android: ListView can't get full layout_height in ScrollView

    I have two questions: - How to get a dynamic height(fill_parent, match_parent) for my ListView? If I write "layout_height: fill_parent" it's not really working - How can I get a solution without ScrollView, only with the ListView? (Without…
    1 2 3 4
    5