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
3
votes
3 answers

Relative Layout fill_parent issue

First of all, I am new to Android development so this might be a simple issue but I really can't get it working. I have the following layout.
simonbs
  • 7,932
  • 13
  • 69
  • 115
3
votes
2 answers

android: fill_parent of child view fills screen

I'm trying to replicate a spinner control (please don't ask why) I'm struggling with the divider. The fake spinner looks fine until I add the divider to the left of the imageview. Once I add the divider it's height fills the remaining portion of the…
user806821
  • 37
  • 1
  • 5
3
votes
2 answers

"Workspace" child views not filling height on Google "iosched" app

I'm playing around with the iosched app from Google I/O 2011. Looking at the ScheduleFragment, I'm testing a different view on the Workspace children for flinging the pages back and forth. However, I'm having trouble getting my child views to fill…
robertmiles3
  • 899
  • 10
  • 20
3
votes
0 answers

How remove margin and the application icon in the custom ActionBar?

I create an app with custom ActioBar. It works, but not on all devices. On Lenovo k990 it is not correct. - I am sorry - Lenovo k900 It should look like this First variant ViewGroup actionBarLayout = (ViewGroup)…
3
votes
2 answers

android - Rounded Linear Layout corner overlapped by fill_parent TextView

This is what I need to the top of my layout This is what I actually have There would be a simple option that I'm not calculating at the moment. Drawable for rounded corners
3
votes
2 answers

TextView height does not match_parent / fill_parent

I have a simple TextView with a singleLine. I would like to set the height to match_parent/fill_parent, but the behaviour of Android is to only to wrap_content. Is there a way to force that the TextView takes all height ? Tkx Edit : This is what I…
g123k
  • 3,748
  • 6
  • 42
  • 45
2
votes
1 answer

fill_parent is not filling entire screen in LinearLayout

I tried to search for this answer and the closest I got to an answer was to add android:resizable="true", which is deprecated. I apologize if this question has been answered but I couldn't find it if it was. Anyway, my app is not filling the entire…
jacky
  • 195
  • 6
  • 17
2
votes
1 answer

Android TextView not filling width, why?

I have the following layout and call to that layout. At one point this very same code would fill the width of the parent layout, a tab. Now it does not and I can't figure out why. It is keeping me from releasing my latest version. Any and all input…
Will Tartak
  • 548
  • 7
  • 17
2
votes
2 answers

android XML scrollview and linear layout problem

I have the following code:
Brahadeesh
  • 2,245
  • 8
  • 40
  • 58
2
votes
1 answer

Set a FILL_PARENT width to a TextView, which is inside of a TableRow

I have a TextView inside of the TableRow. Is there any way to set a FILL_PARENT width to this TextView? Edited: Doesn't FILL when I have a backgroundImage to the TableRow
coffee
  • 3,048
  • 4
  • 32
  • 46
2
votes
3 answers

Android ListView not taking up its height

I have a very strange problem here. In the following xml section I'm trying to use include:
Levente Kürti
  • 1,005
  • 1
  • 12
  • 23
2
votes
1 answer
2
votes
5 answers

LinearLayout android layout_height

Help me with XML layout. I have three LinearLayout on activity, all LinearLayout have position vertical (from top to bottom) My LinearLayout positions first LinearLayout have android:layout_height="30px", android:layout_width="fill_parent" second…
2
votes
1 answer

LinearLayout doesn't fill the parent

LinearLayout doesn't fill the parent. I need to fill all elements by width. Here is a photo that is showing on the smartphone. But in Android Studio xml preview all is looking right.
2
votes
1 answer

Android layout - how to tell a view that it should try to fill it's parent, but at least wraps it's content

Is it possible to tell a view, that it should at least wrap it's content but if the parent view leaves space to stretch, than it should fill it's parent? Example: What I want is, that the container linear layout wraps around it's content... and that…
prom85
  • 16,896
  • 17
  • 122
  • 242