nirhart / ParallaxScroll

Parallax ScrollView and ListView for Android
MIT License
848 stars 187 forks source link

TextView cuts off while using ParallaxScrollView #15

Closed MDXDave closed 9 years ago

MDXDave commented 9 years ago

screenshot_2014-08-25-20-41-27

I've used the following layout for the Parallax effect:

<com.nirhart.parallaxscroll.views.ParallaxScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:parallax_factor="2"
    android:fitsSystemWindows="true"
    android:background="#ffffffff">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true"
        android:orientation="vertical" >

        <ImageView
            android:id="@+id/article_image"
            android:layout_width="match_parent"
            android:layout_height="150dp"
            android:adjustViewBounds="true"
            android:baselineAlignBottom="true"
            android:cropToPadding="true"
            android:scaleType="fitCenter"
            android:src="@drawable/about_teaser"
            android:background="#36487d" />

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:background="#ffffffff"
               >

                <TextView
                    android:id="@+id/title"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="10dp"
                    android:layout_marginTop="10dp"
                    android:text="@string/app_name"
                    android:textColor="#50A7B3"
                    android:textAppearance="?android:attr/textAppearanceLarge"
                    />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textAppearance="?android:attr/textAppearanceSmall"
                    android:text="Version unbekannt"
                    android:id="@+id/version"
                    android:textColor="#696969"
                    android:layout_marginBottom="10dp"
                    android:layout_marginStart="10dp"
                    android:layout_marginLeft="10dp"/>

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:textAppearance="?android:attr/textAppearanceMedium"
                    android:text=""
                    android:id="@+id/text"
                    android:clickable="true"
                    android:autoLink="email|web"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:layout_marginTop="10dp"
                    android:layout_marginBottom="10dp"
                    android:textColor="#696969"/>

            </LinearLayout>
    </LinearLayout>
</com.nirhart.parallaxscroll.views.ParallaxScrollView>

Any fix for this issue?

The only fix i know is to add margin/padding manually, but the problem is that with different devices the padding/margin is too much or too less....

nirhart commented 9 years ago

I'm not sure I understand your problem, You provide an xml with image but there is no image in the screenshot. Moreover, padding and margin should stay the same across all devices if you use dp.

MDXDave commented 9 years ago

Hey, the problem is that text at the bottom is cut off, on the screenshot it's shown when I scroll down to the end, but there is more content below, but I can't scroll to it..

nirhart commented 9 years ago

Well that's weird, I just tried it myself with your code, with and without the third textView and with and without the margins and its all working fine for me. I don't believe that it has something to do with the library since its not changing the default scroll behavior of scrollView, but touching the draw offset of the first item. you can verify it by switching from parallaxScrollView to regular scrollView and see if the problem is still exists.

MDXDave commented 9 years ago

Thanks for your answer!

I've tried to switch to the original ScrollView - and it works without any issues. After switch back to ParallaxScrollView the TextView is cut off again :(

Edit: The TextView is filled with text programmatically

nirhart commented 9 years ago

can you tell me which android version and device are you using?

MDXDave commented 9 years ago

AndroidVersion: 4.4.3 KitKat Device: HTC One / Nexus 5

nirhart commented 9 years ago

I'm sorry, I can't reproduce it and can't think of the reason, I'll be glad to keep try and figuring it out, maybe try to send me the apk to the mail to see if I'll be able to reproduce it, or more code snipped if you are doing something special with the texts or with the styles...

MDXDave commented 9 years ago

I think i know whats the problem, after removing the app:parallax_factor="2" attribute, i can see all of the content again, maybe their is a bug by using this parameter?