LinearLayout not expanding inside a ScrollView
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I have a LinearLayout
inside a ScrollView
that has android:layout_height="fill_parent"
, but it doesn't expand to the full height of the ScrollView
. My layout looks something like:
level layout layout_width layout_height
1 LinearLayout fill_parent fill_parent
2 LinearLayout fill_parent wrap_content
3 (some irrelevant stuff)
2 ScrollView fill_parent fill_parent <-- this expands full height
3 LinearLayout fill_parent fill_parent <-- this does not (has orientation=vertical)
(following stuff probably are irrelevant, but just to be sure:)
4 TextView fill_parent fill_parent
4 LinearLayout fill_parent wrap_content
I can see that the LinearLayout
doesn't expand the full height of the ScrollView
because in Eclipse in Android Layout Editor
, if I select the ScrollView
(in the Outline panel) it is highlighted with a red border that fills the screen to the bottom but when I select the LinearLayout
its highlight doesn't expand to the bottom of the screen. How can I get it to do so?
The effect I'm trying to achieve is to have some text and a button below it (inside the LinearLayout
in level 4 there's just a button). The text can be big enough to need a scrollbar, in which case I want the user to have to scroll down in order to see the button. In case the text is not big enough for a scroll bar, I want the LinearLayout
containing the button to stick to the bottom of the screen.
At first I thought I shouldn't post the full XML because it's usually a turn-down to see a huge chunk of code in a question. However, it seems it might be necessary, so here's the full layout.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="@+id/video_layout"
android:focusable="true"
style="@style/VideoLayout">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:foreground="@android:drawable/ic_media_play"
android:foregroundGravity="center">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/video_thumb"
android:padding="5dip"
android:background="#454545"/>
</FrameLayout>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:focusable="true"
style="@style/VideoTitle"
android:id="@+id/video_title"
android:layout_gravity="center"
android:layout_weight="1"/>
</LinearLayout>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1">
<!-- this ScrollView expands the full height of the screen.
However, the next LinearLayout does not expand the full height of the ScrollView -->
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:layout_gravity="fill"
android:orientation="vertical"
android:id="@+id/info_layout">
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/info_body"
style="@style/InfoText"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
style="@android:style/ButtonBar">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:text="@string/button_readmore"
android:id="@+id/btn_read_more"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
At the moment I have resorted to android:layout_gravity="bottom"
on the problematic LinearLayout
, which makes the button stick to the bottom of the screen no matter what. But that also makes the text stick to the bottom of the screen, which is not exactly what I was after.
Update: scratch that, android:layout_gravity="bottom"
makes the ScrollView
unable to, well, scroll. Other ideas?
android android-layout
add a comment |
I have a LinearLayout
inside a ScrollView
that has android:layout_height="fill_parent"
, but it doesn't expand to the full height of the ScrollView
. My layout looks something like:
level layout layout_width layout_height
1 LinearLayout fill_parent fill_parent
2 LinearLayout fill_parent wrap_content
3 (some irrelevant stuff)
2 ScrollView fill_parent fill_parent <-- this expands full height
3 LinearLayout fill_parent fill_parent <-- this does not (has orientation=vertical)
(following stuff probably are irrelevant, but just to be sure:)
4 TextView fill_parent fill_parent
4 LinearLayout fill_parent wrap_content
I can see that the LinearLayout
doesn't expand the full height of the ScrollView
because in Eclipse in Android Layout Editor
, if I select the ScrollView
(in the Outline panel) it is highlighted with a red border that fills the screen to the bottom but when I select the LinearLayout
its highlight doesn't expand to the bottom of the screen. How can I get it to do so?
The effect I'm trying to achieve is to have some text and a button below it (inside the LinearLayout
in level 4 there's just a button). The text can be big enough to need a scrollbar, in which case I want the user to have to scroll down in order to see the button. In case the text is not big enough for a scroll bar, I want the LinearLayout
containing the button to stick to the bottom of the screen.
At first I thought I shouldn't post the full XML because it's usually a turn-down to see a huge chunk of code in a question. However, it seems it might be necessary, so here's the full layout.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="@+id/video_layout"
android:focusable="true"
style="@style/VideoLayout">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:foreground="@android:drawable/ic_media_play"
android:foregroundGravity="center">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/video_thumb"
android:padding="5dip"
android:background="#454545"/>
</FrameLayout>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:focusable="true"
style="@style/VideoTitle"
android:id="@+id/video_title"
android:layout_gravity="center"
android:layout_weight="1"/>
</LinearLayout>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1">
<!-- this ScrollView expands the full height of the screen.
However, the next LinearLayout does not expand the full height of the ScrollView -->
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:layout_gravity="fill"
android:orientation="vertical"
android:id="@+id/info_layout">
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/info_body"
style="@style/InfoText"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
style="@android:style/ButtonBar">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:text="@string/button_readmore"
android:id="@+id/btn_read_more"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
At the moment I have resorted to android:layout_gravity="bottom"
on the problematic LinearLayout
, which makes the button stick to the bottom of the screen no matter what. But that also makes the text stick to the bottom of the screen, which is not exactly what I was after.
Update: scratch that, android:layout_gravity="bottom"
makes the ScrollView
unable to, well, scroll. Other ideas?
android android-layout
add a comment |
I have a LinearLayout
inside a ScrollView
that has android:layout_height="fill_parent"
, but it doesn't expand to the full height of the ScrollView
. My layout looks something like:
level layout layout_width layout_height
1 LinearLayout fill_parent fill_parent
2 LinearLayout fill_parent wrap_content
3 (some irrelevant stuff)
2 ScrollView fill_parent fill_parent <-- this expands full height
3 LinearLayout fill_parent fill_parent <-- this does not (has orientation=vertical)
(following stuff probably are irrelevant, but just to be sure:)
4 TextView fill_parent fill_parent
4 LinearLayout fill_parent wrap_content
I can see that the LinearLayout
doesn't expand the full height of the ScrollView
because in Eclipse in Android Layout Editor
, if I select the ScrollView
(in the Outline panel) it is highlighted with a red border that fills the screen to the bottom but when I select the LinearLayout
its highlight doesn't expand to the bottom of the screen. How can I get it to do so?
The effect I'm trying to achieve is to have some text and a button below it (inside the LinearLayout
in level 4 there's just a button). The text can be big enough to need a scrollbar, in which case I want the user to have to scroll down in order to see the button. In case the text is not big enough for a scroll bar, I want the LinearLayout
containing the button to stick to the bottom of the screen.
At first I thought I shouldn't post the full XML because it's usually a turn-down to see a huge chunk of code in a question. However, it seems it might be necessary, so here's the full layout.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="@+id/video_layout"
android:focusable="true"
style="@style/VideoLayout">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:foreground="@android:drawable/ic_media_play"
android:foregroundGravity="center">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/video_thumb"
android:padding="5dip"
android:background="#454545"/>
</FrameLayout>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:focusable="true"
style="@style/VideoTitle"
android:id="@+id/video_title"
android:layout_gravity="center"
android:layout_weight="1"/>
</LinearLayout>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1">
<!-- this ScrollView expands the full height of the screen.
However, the next LinearLayout does not expand the full height of the ScrollView -->
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:layout_gravity="fill"
android:orientation="vertical"
android:id="@+id/info_layout">
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/info_body"
style="@style/InfoText"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
style="@android:style/ButtonBar">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:text="@string/button_readmore"
android:id="@+id/btn_read_more"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
At the moment I have resorted to android:layout_gravity="bottom"
on the problematic LinearLayout
, which makes the button stick to the bottom of the screen no matter what. But that also makes the text stick to the bottom of the screen, which is not exactly what I was after.
Update: scratch that, android:layout_gravity="bottom"
makes the ScrollView
unable to, well, scroll. Other ideas?
android android-layout
I have a LinearLayout
inside a ScrollView
that has android:layout_height="fill_parent"
, but it doesn't expand to the full height of the ScrollView
. My layout looks something like:
level layout layout_width layout_height
1 LinearLayout fill_parent fill_parent
2 LinearLayout fill_parent wrap_content
3 (some irrelevant stuff)
2 ScrollView fill_parent fill_parent <-- this expands full height
3 LinearLayout fill_parent fill_parent <-- this does not (has orientation=vertical)
(following stuff probably are irrelevant, but just to be sure:)
4 TextView fill_parent fill_parent
4 LinearLayout fill_parent wrap_content
I can see that the LinearLayout
doesn't expand the full height of the ScrollView
because in Eclipse in Android Layout Editor
, if I select the ScrollView
(in the Outline panel) it is highlighted with a red border that fills the screen to the bottom but when I select the LinearLayout
its highlight doesn't expand to the bottom of the screen. How can I get it to do so?
The effect I'm trying to achieve is to have some text and a button below it (inside the LinearLayout
in level 4 there's just a button). The text can be big enough to need a scrollbar, in which case I want the user to have to scroll down in order to see the button. In case the text is not big enough for a scroll bar, I want the LinearLayout
containing the button to stick to the bottom of the screen.
At first I thought I shouldn't post the full XML because it's usually a turn-down to see a huge chunk of code in a question. However, it seems it might be necessary, so here's the full layout.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="@+id/video_layout"
android:focusable="true"
style="@style/VideoLayout">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:foreground="@android:drawable/ic_media_play"
android:foregroundGravity="center">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/video_thumb"
android:padding="5dip"
android:background="#454545"/>
</FrameLayout>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:focusable="true"
style="@style/VideoTitle"
android:id="@+id/video_title"
android:layout_gravity="center"
android:layout_weight="1"/>
</LinearLayout>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1">
<!-- this ScrollView expands the full height of the screen.
However, the next LinearLayout does not expand the full height of the ScrollView -->
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:layout_gravity="fill"
android:orientation="vertical"
android:id="@+id/info_layout">
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/info_body"
style="@style/InfoText"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
style="@android:style/ButtonBar">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:text="@string/button_readmore"
android:id="@+id/btn_read_more"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
At the moment I have resorted to android:layout_gravity="bottom"
on the problematic LinearLayout
, which makes the button stick to the bottom of the screen no matter what. But that also makes the text stick to the bottom of the screen, which is not exactly what I was after.
Update: scratch that, android:layout_gravity="bottom"
makes the ScrollView
unable to, well, scroll. Other ideas?
android android-layout
android android-layout
edited Apr 9 '10 at 9:53
Felix
asked Apr 8 '10 at 12:38
FelixFelix
64.2k38137162
64.2k38137162
add a comment |
add a comment |
6 Answers
6
active
oldest
votes
Found the solution myself in the end. The problem was not with the LinearLayout
, but with the ScrollView
(seems weird, considering the fact that the ScrollView
was expanding, while the LinearLayout
wasn't).
The solution was to use android:fillViewport="true"
on the ScrollView
.
4
Note that the LinearLayout will expand vertically, but this may not necessarily be reflected in your layout unless it contains a control that consumes that additional space usingandroid:weight
.
– Paul Lammertsma
Sep 11 '13 at 8:50
This really helps. Thanks for that. But without this code sometimes works good. Do you know why?
– Ashok Chakravarthi
Dec 29 '14 at 7:16
not working for <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:fillViewport="true" android:background="#000" android:orientation="vertical" > </LinearLayout>
– Prasad
Mar 13 '15 at 10:02
3
So sick I was sitting for hours and searching whats wrong with my code. For what this paramater? When you would ever like to set it false?
– MyWay
Sep 15 '15 at 20:40
@Prasad make your height of linear layout to match parent
– goonerDroid
Oct 13 '15 at 10:55
|
show 1 more comment
I know this post is very old, For those who don't want to use android:fillViewport="true"
because it sometimes doesn't bring up the edittext above keyboard.
Use Relative layout instead of LinearLayout it solves the purpose.
add a comment |
Can you provide your layout xml? Doing so would allow people to recreate the issue with minimal effort.
You might have to set
android:layout_weight="1"
for the item that you want expanded
1
Thank you for your answer. I tried your suggestion but it didn't work. I also updated my question to include the layout xml.
– Felix
Apr 9 '10 at 9:45
add a comment |
I have dynamically used to get this . I have a LinearLayout and within this used ScrollView as a child. Then i take again LinearLayout and add what ever View u want to this LinearLayout and then this LinearLayout add to ScrollView and finally add this ScrollView to LinearLayout. Then u can get scroll in ur ScrollView and nothing will left to visible.
LinearLayout(Parent)--ScrollView(child of LinerLayout) -- LinearLayout(child of ScrollView)-- add here textView, Buttons , spinner etc whatever u want . Then add this LinearLyout to ScrollView. Bcoz only one CHILD for ScrollView applicable and last add this ScrollView to LinearLyout.If defined area is exceed from Screen size then u will get a Scroll within ScrollView.
But this solution makes the xml more complicated, and takes more time to inflate.
– twlkyao
Aug 19 '15 at 9:07
add a comment |
In my case i haven't given the
orientation of LinearLayout(ScrollView's Child)
So by default it takes horizontal, but scrollview scrols vertically, so please check if 'android:orientation="vertical"' is set to your ScrollView's Child(In the case of LinearLayout).
This was my case hopes it helps somebody
.
add a comment |
The solution is to use
android:fillViewport="true"
on Scroll view and moreover try to use
"wrap_content"
instead of "fill_parent"
as "fill_parent"
is deprecated now.
add a comment |
protected by Felix Dec 13 '12 at 9:58
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
6 Answers
6
active
oldest
votes
6 Answers
6
active
oldest
votes
active
oldest
votes
active
oldest
votes
Found the solution myself in the end. The problem was not with the LinearLayout
, but with the ScrollView
(seems weird, considering the fact that the ScrollView
was expanding, while the LinearLayout
wasn't).
The solution was to use android:fillViewport="true"
on the ScrollView
.
4
Note that the LinearLayout will expand vertically, but this may not necessarily be reflected in your layout unless it contains a control that consumes that additional space usingandroid:weight
.
– Paul Lammertsma
Sep 11 '13 at 8:50
This really helps. Thanks for that. But without this code sometimes works good. Do you know why?
– Ashok Chakravarthi
Dec 29 '14 at 7:16
not working for <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:fillViewport="true" android:background="#000" android:orientation="vertical" > </LinearLayout>
– Prasad
Mar 13 '15 at 10:02
3
So sick I was sitting for hours and searching whats wrong with my code. For what this paramater? When you would ever like to set it false?
– MyWay
Sep 15 '15 at 20:40
@Prasad make your height of linear layout to match parent
– goonerDroid
Oct 13 '15 at 10:55
|
show 1 more comment
Found the solution myself in the end. The problem was not with the LinearLayout
, but with the ScrollView
(seems weird, considering the fact that the ScrollView
was expanding, while the LinearLayout
wasn't).
The solution was to use android:fillViewport="true"
on the ScrollView
.
4
Note that the LinearLayout will expand vertically, but this may not necessarily be reflected in your layout unless it contains a control that consumes that additional space usingandroid:weight
.
– Paul Lammertsma
Sep 11 '13 at 8:50
This really helps. Thanks for that. But without this code sometimes works good. Do you know why?
– Ashok Chakravarthi
Dec 29 '14 at 7:16
not working for <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:fillViewport="true" android:background="#000" android:orientation="vertical" > </LinearLayout>
– Prasad
Mar 13 '15 at 10:02
3
So sick I was sitting for hours and searching whats wrong with my code. For what this paramater? When you would ever like to set it false?
– MyWay
Sep 15 '15 at 20:40
@Prasad make your height of linear layout to match parent
– goonerDroid
Oct 13 '15 at 10:55
|
show 1 more comment
Found the solution myself in the end. The problem was not with the LinearLayout
, but with the ScrollView
(seems weird, considering the fact that the ScrollView
was expanding, while the LinearLayout
wasn't).
The solution was to use android:fillViewport="true"
on the ScrollView
.
Found the solution myself in the end. The problem was not with the LinearLayout
, but with the ScrollView
(seems weird, considering the fact that the ScrollView
was expanding, while the LinearLayout
wasn't).
The solution was to use android:fillViewport="true"
on the ScrollView
.
answered Apr 9 '10 at 10:29
FelixFelix
64.2k38137162
64.2k38137162
4
Note that the LinearLayout will expand vertically, but this may not necessarily be reflected in your layout unless it contains a control that consumes that additional space usingandroid:weight
.
– Paul Lammertsma
Sep 11 '13 at 8:50
This really helps. Thanks for that. But without this code sometimes works good. Do you know why?
– Ashok Chakravarthi
Dec 29 '14 at 7:16
not working for <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:fillViewport="true" android:background="#000" android:orientation="vertical" > </LinearLayout>
– Prasad
Mar 13 '15 at 10:02
3
So sick I was sitting for hours and searching whats wrong with my code. For what this paramater? When you would ever like to set it false?
– MyWay
Sep 15 '15 at 20:40
@Prasad make your height of linear layout to match parent
– goonerDroid
Oct 13 '15 at 10:55
|
show 1 more comment
4
Note that the LinearLayout will expand vertically, but this may not necessarily be reflected in your layout unless it contains a control that consumes that additional space usingandroid:weight
.
– Paul Lammertsma
Sep 11 '13 at 8:50
This really helps. Thanks for that. But without this code sometimes works good. Do you know why?
– Ashok Chakravarthi
Dec 29 '14 at 7:16
not working for <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:fillViewport="true" android:background="#000" android:orientation="vertical" > </LinearLayout>
– Prasad
Mar 13 '15 at 10:02
3
So sick I was sitting for hours and searching whats wrong with my code. For what this paramater? When you would ever like to set it false?
– MyWay
Sep 15 '15 at 20:40
@Prasad make your height of linear layout to match parent
– goonerDroid
Oct 13 '15 at 10:55
4
4
Note that the LinearLayout will expand vertically, but this may not necessarily be reflected in your layout unless it contains a control that consumes that additional space using
android:weight
.– Paul Lammertsma
Sep 11 '13 at 8:50
Note that the LinearLayout will expand vertically, but this may not necessarily be reflected in your layout unless it contains a control that consumes that additional space using
android:weight
.– Paul Lammertsma
Sep 11 '13 at 8:50
This really helps. Thanks for that. But without this code sometimes works good. Do you know why?
– Ashok Chakravarthi
Dec 29 '14 at 7:16
This really helps. Thanks for that. But without this code sometimes works good. Do you know why?
– Ashok Chakravarthi
Dec 29 '14 at 7:16
not working for <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:fillViewport="true" android:background="#000" android:orientation="vertical" > </LinearLayout>
– Prasad
Mar 13 '15 at 10:02
not working for <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:fillViewport="true" android:background="#000" android:orientation="vertical" > </LinearLayout>
– Prasad
Mar 13 '15 at 10:02
3
3
So sick I was sitting for hours and searching whats wrong with my code. For what this paramater? When you would ever like to set it false?
– MyWay
Sep 15 '15 at 20:40
So sick I was sitting for hours and searching whats wrong with my code. For what this paramater? When you would ever like to set it false?
– MyWay
Sep 15 '15 at 20:40
@Prasad make your height of linear layout to match parent
– goonerDroid
Oct 13 '15 at 10:55
@Prasad make your height of linear layout to match parent
– goonerDroid
Oct 13 '15 at 10:55
|
show 1 more comment
I know this post is very old, For those who don't want to use android:fillViewport="true"
because it sometimes doesn't bring up the edittext above keyboard.
Use Relative layout instead of LinearLayout it solves the purpose.
add a comment |
I know this post is very old, For those who don't want to use android:fillViewport="true"
because it sometimes doesn't bring up the edittext above keyboard.
Use Relative layout instead of LinearLayout it solves the purpose.
add a comment |
I know this post is very old, For those who don't want to use android:fillViewport="true"
because it sometimes doesn't bring up the edittext above keyboard.
Use Relative layout instead of LinearLayout it solves the purpose.
I know this post is very old, For those who don't want to use android:fillViewport="true"
because it sometimes doesn't bring up the edittext above keyboard.
Use Relative layout instead of LinearLayout it solves the purpose.
answered Sep 14 '15 at 7:12
Hardik4560Hardik4560
2,6761429
2,6761429
add a comment |
add a comment |
Can you provide your layout xml? Doing so would allow people to recreate the issue with minimal effort.
You might have to set
android:layout_weight="1"
for the item that you want expanded
1
Thank you for your answer. I tried your suggestion but it didn't work. I also updated my question to include the layout xml.
– Felix
Apr 9 '10 at 9:45
add a comment |
Can you provide your layout xml? Doing so would allow people to recreate the issue with minimal effort.
You might have to set
android:layout_weight="1"
for the item that you want expanded
1
Thank you for your answer. I tried your suggestion but it didn't work. I also updated my question to include the layout xml.
– Felix
Apr 9 '10 at 9:45
add a comment |
Can you provide your layout xml? Doing so would allow people to recreate the issue with minimal effort.
You might have to set
android:layout_weight="1"
for the item that you want expanded
Can you provide your layout xml? Doing so would allow people to recreate the issue with minimal effort.
You might have to set
android:layout_weight="1"
for the item that you want expanded
answered Apr 8 '10 at 13:09
snctlnsnctln
11.4k53940
11.4k53940
1
Thank you for your answer. I tried your suggestion but it didn't work. I also updated my question to include the layout xml.
– Felix
Apr 9 '10 at 9:45
add a comment |
1
Thank you for your answer. I tried your suggestion but it didn't work. I also updated my question to include the layout xml.
– Felix
Apr 9 '10 at 9:45
1
1
Thank you for your answer. I tried your suggestion but it didn't work. I also updated my question to include the layout xml.
– Felix
Apr 9 '10 at 9:45
Thank you for your answer. I tried your suggestion but it didn't work. I also updated my question to include the layout xml.
– Felix
Apr 9 '10 at 9:45
add a comment |
I have dynamically used to get this . I have a LinearLayout and within this used ScrollView as a child. Then i take again LinearLayout and add what ever View u want to this LinearLayout and then this LinearLayout add to ScrollView and finally add this ScrollView to LinearLayout. Then u can get scroll in ur ScrollView and nothing will left to visible.
LinearLayout(Parent)--ScrollView(child of LinerLayout) -- LinearLayout(child of ScrollView)-- add here textView, Buttons , spinner etc whatever u want . Then add this LinearLyout to ScrollView. Bcoz only one CHILD for ScrollView applicable and last add this ScrollView to LinearLyout.If defined area is exceed from Screen size then u will get a Scroll within ScrollView.
But this solution makes the xml more complicated, and takes more time to inflate.
– twlkyao
Aug 19 '15 at 9:07
add a comment |
I have dynamically used to get this . I have a LinearLayout and within this used ScrollView as a child. Then i take again LinearLayout and add what ever View u want to this LinearLayout and then this LinearLayout add to ScrollView and finally add this ScrollView to LinearLayout. Then u can get scroll in ur ScrollView and nothing will left to visible.
LinearLayout(Parent)--ScrollView(child of LinerLayout) -- LinearLayout(child of ScrollView)-- add here textView, Buttons , spinner etc whatever u want . Then add this LinearLyout to ScrollView. Bcoz only one CHILD for ScrollView applicable and last add this ScrollView to LinearLyout.If defined area is exceed from Screen size then u will get a Scroll within ScrollView.
But this solution makes the xml more complicated, and takes more time to inflate.
– twlkyao
Aug 19 '15 at 9:07
add a comment |
I have dynamically used to get this . I have a LinearLayout and within this used ScrollView as a child. Then i take again LinearLayout and add what ever View u want to this LinearLayout and then this LinearLayout add to ScrollView and finally add this ScrollView to LinearLayout. Then u can get scroll in ur ScrollView and nothing will left to visible.
LinearLayout(Parent)--ScrollView(child of LinerLayout) -- LinearLayout(child of ScrollView)-- add here textView, Buttons , spinner etc whatever u want . Then add this LinearLyout to ScrollView. Bcoz only one CHILD for ScrollView applicable and last add this ScrollView to LinearLyout.If defined area is exceed from Screen size then u will get a Scroll within ScrollView.
I have dynamically used to get this . I have a LinearLayout and within this used ScrollView as a child. Then i take again LinearLayout and add what ever View u want to this LinearLayout and then this LinearLayout add to ScrollView and finally add this ScrollView to LinearLayout. Then u can get scroll in ur ScrollView and nothing will left to visible.
LinearLayout(Parent)--ScrollView(child of LinerLayout) -- LinearLayout(child of ScrollView)-- add here textView, Buttons , spinner etc whatever u want . Then add this LinearLyout to ScrollView. Bcoz only one CHILD for ScrollView applicable and last add this ScrollView to LinearLyout.If defined area is exceed from Screen size then u will get a Scroll within ScrollView.
answered Dec 9 '10 at 18:58
BrajBraj
291
291
But this solution makes the xml more complicated, and takes more time to inflate.
– twlkyao
Aug 19 '15 at 9:07
add a comment |
But this solution makes the xml more complicated, and takes more time to inflate.
– twlkyao
Aug 19 '15 at 9:07
But this solution makes the xml more complicated, and takes more time to inflate.
– twlkyao
Aug 19 '15 at 9:07
But this solution makes the xml more complicated, and takes more time to inflate.
– twlkyao
Aug 19 '15 at 9:07
add a comment |
In my case i haven't given the
orientation of LinearLayout(ScrollView's Child)
So by default it takes horizontal, but scrollview scrols vertically, so please check if 'android:orientation="vertical"' is set to your ScrollView's Child(In the case of LinearLayout).
This was my case hopes it helps somebody
.
add a comment |
In my case i haven't given the
orientation of LinearLayout(ScrollView's Child)
So by default it takes horizontal, but scrollview scrols vertically, so please check if 'android:orientation="vertical"' is set to your ScrollView's Child(In the case of LinearLayout).
This was my case hopes it helps somebody
.
add a comment |
In my case i haven't given the
orientation of LinearLayout(ScrollView's Child)
So by default it takes horizontal, but scrollview scrols vertically, so please check if 'android:orientation="vertical"' is set to your ScrollView's Child(In the case of LinearLayout).
This was my case hopes it helps somebody
.
In my case i haven't given the
orientation of LinearLayout(ScrollView's Child)
So by default it takes horizontal, but scrollview scrols vertically, so please check if 'android:orientation="vertical"' is set to your ScrollView's Child(In the case of LinearLayout).
This was my case hopes it helps somebody
.
answered Feb 3 '15 at 7:47
Vishal PandeyVishal Pandey
64586
64586
add a comment |
add a comment |
The solution is to use
android:fillViewport="true"
on Scroll view and moreover try to use
"wrap_content"
instead of "fill_parent"
as "fill_parent"
is deprecated now.
add a comment |
The solution is to use
android:fillViewport="true"
on Scroll view and moreover try to use
"wrap_content"
instead of "fill_parent"
as "fill_parent"
is deprecated now.
add a comment |
The solution is to use
android:fillViewport="true"
on Scroll view and moreover try to use
"wrap_content"
instead of "fill_parent"
as "fill_parent"
is deprecated now.
The solution is to use
android:fillViewport="true"
on Scroll view and moreover try to use
"wrap_content"
instead of "fill_parent"
as "fill_parent"
is deprecated now.
edited Nov 16 '18 at 13:47
Aniruddh Parihar
2,21911129
2,21911129
answered Sep 21 '18 at 12:50
Khushboo AggarwalKhushboo Aggarwal
694
694
add a comment |
add a comment |
protected by Felix Dec 13 '12 at 9:58
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?