I designed a headerlayout(background is transparent) which is not in the scrollview and a scrollview which is in below of that header,in that scrollview have a layout with fixed height 1000dp and in the scrollview i added the views dynamically upto this its fine for me..But my problem is when i scroll the scrollview the background image also moving(background image height is 1550px) at the same time i want to change the background for the header as it is in scrollview background.....
i am not able to implement this please anyone help me in this designing..Below is my designing code..
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/navbar"
android:background="#drawable/navbar_blooptransprant64"
/>
<ScrollView
android:layout_below="#+id/navbar"
android:id="#+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1000dp"
android:background="#drawable/new_bg"
android:orientation="vertical"
>
<LinearLayout
android:id="#+id/outer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
</LinearLayout>
</LinearLayout>
</ScrollView>
Related
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/notesLayoutManagerScrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fffaaa"
android:fillViewport="true"
tools:context="com.gp.app.professionalpa.layout.manager.NotesLayoutManagerActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/notesLayoutManagerParentLinearLayout"
android:orientation="horizontal"
android:background="#ffffff"
android:baselineAligned="false">
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="0dip"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="1"
android:layout_marginRight="1dip"
android:background="#ffffff">
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="0dip"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="1"
android:layout_marginLeft="1dip"
android:background="#ffffff">
</LinearLayout>
</LinearLayout>
</ScrollView>
with the above layout.xml code scroll bar does not appear when the content of the linear layout with ids "linearLayout1" and "linearLayout2" grow in size vertically.
Please suggest how can i bring scrollbar in my activity view when the size of "linearLayout1" and "linearLayout2" grows beyond parent size. I want single scroll bar for my complete activity view and not separate scroll bars for "linearLayout1" and "linearLayout2".
ScrollView should have a layout_height of wrap_content as well.
I want to programatically add viwes to vertical orientation linearlayout within horizontalscrollview within Scrollview. Basic scheme of my layout is belowe:
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:fillViewport="true"
android:fadingEdge="none">
<LinearLayout
android:id="#+id/header"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!-- same header code -->
</LinearLaout>
<HorizontalScrollView
android:layout_height="wrap_content"
android:layout_width="wrap_content" >
<LinearLayout
android:id="#+id/list_view"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:orientation="vertical"/>
</HorizontalScrollView>
</ScrollView>
Now if i'm adding programatically 5 views to list_view linearlayout, i get only one view, and free sapce below it. If i comment HorizontallScrollView like that:
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:fillViewport="true"
android:fadingEdge="none">
<LinearLayout
android:id="#+id/header"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!-- same header code -->
</LinearLaout>
<LinearLayout
android:id="#+id/list_view"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:orientation="vertical"/>
</ScrollView>
All views are show correct, but they aren't horizontall scrollable. Please give me same ideas how to solve this problem.
Answer is to change linearlayout's android:layout_width attribute to wrap_content within horizontalScrollview
I have a vertical ScrollView with some ImageViews that I can scroll up and down. At the bottom of my application I have a footer consisting of a LinearLayout with a partly transparent background image (png). How do I achieve the following behavior?
Consider the following layout
<LinearLayout blah blah... >
<RelativeLayout
android:id="#+id/guesses_scroll_view_holder"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ScrollView
android:id="#+id/guesses_scroll_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/bgrepeat"
android:scrollbarStyle="outsideOverlay"
android:layout_above="#+id/footer" >
<LinearLayout
android:id="#+id/guesses"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/bgrepeat"
android:orientation="vertical" >
</LinearLayout>
</ScrollView>
<LinearLayout
android:id="#+id/footer"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#drawable/peg_picker_bgrepeat"
android:orientation="vertical" >
< some footer content />
</LinearLayout>
</RelativeLayout></LinearLayout>
What I got at the moment is something that looks like this
Since my background image peg_picker_bgrepeat is not rectangular, I get an ugly border above the ScrollView. How can I make the contents "scroll behind" the footer?
My mind is a bit boggled... in the following XML, I would expect my LinearLayout/TextView to be the same size as my ScrollView. As you can see from my included image, this is not the case.
What is going on here? Why is my LinearLayout not the same size as the ScrollView?
<ScrollView
android:id="#+id/scrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#008B8B" >
<LinearLayout
android:id="#+id/contentLayout"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#DC143C" >
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="hello" />
</LinearLayout>
</ScrollView>
use
android:fillViewport="true"
in your ScrollView
In following code the viewflipper is not taking the whole screen it just wraps around the textview. why is this happening ?
<?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" >
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#0000ff" >
<ViewFlipper android:id="#+id/ViewFlipper01"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#aa0000"
android:layout_gravity="center">
<TextView
android:layout_width="match_parent"
android:layout_height="50dp"></TextView>
</ViewFlipper>
</ScrollView>
</LinearLayout>
In scrollView use
android:fillViewport="true"
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#0000ff" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ViewFlipper android:id="#+id/ViewFlipper01"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#aa0000"
android:layout_gravity="center">
<TextView
android:layout_width="match_parent"
android:layout_height="50dp">
</TextView>
</ViewFlipper>
</LinearLayout>
</ScrollView>
this will work.
Why do you want to increase View Flippers height? View Flipper depends upon the content or views you add inside it..So the height and width of view flipper will be always equal to the largest height/width your provide to the views. In your case its text view so if you increase the height of the current view or add another textView with height greater than the current one view flipper will be increased.