Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

views mismatch #17

Open
GrizzlyDoc opened this issue May 29, 2015 · 9 comments
Open

views mismatch #17

GrizzlyDoc opened this issue May 29, 2015 · 9 comments

Comments

@GrizzlyDoc
Copy link

the library works fine for me, but i am using imageLoaderUniversal to load images for the zoomView and headerView. when the images are loaded, the contentView gets over the zoomView , not under it.
when no images are loaded, the views work fine

thanks for any tip.
br,

@Frank-Zhu
Copy link
Owner

@micheltabib you can try demo load image(I use Picasso),it work to me.you can upload your screen picture and your code,I will try.thanks.

@GrizzlyDoc
Copy link
Author

@Frank-Zhu thank you for you reply. but i found another issue.
When i use the portrait mode ( android:scaleType="centerCrop") for the image in the zoomView, the contentView gets over the zoomView , not under it.

here is a screenshots of the issue followed by the code.

this is how the screen should look like
screenshot_2015-06-04-11-48-40 1

this is how the screen looks like
screenshot_2015-06-04-11-49-23 1

java code

private void loadUserProfileView(){
    PullToZoomScrollViewEx scrollView = (PullToZoomScrollViewEx) findViewById(R.id.user_profile_scroll_view);
    View headView = LayoutInflater.from(this).inflate(R.layout.user_profile_header_view, null, false);
    View zoomView = LayoutInflater.from(this).inflate(R.layout.user_profile_zoom_view, null, false);
    View contentView = LayoutInflater.from(this).inflate(R.layout.user_profile_content_view, null, true);

    scrollView.setHeaderView(headView);
    scrollView.setZoomView(zoomView);
    scrollView.setScrollContentView(contentView);
    scrollView.setParallax(true);

    DisplayMetrics localDisplayMetrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(localDisplayMetrics);
    int mScreenHeight = localDisplayMetrics.heightPixels;
    int mScreenWidth = localDisplayMetrics.widthPixels;

    LinearLayout.LayoutParams localObject = new LinearLayout.LayoutParams(mScreenWidth, (int) (9.0F * (mScreenWidth / 16.0F)));
    scrollView.setHeaderLayoutParams(localObject);

}

xml layout code for the "ZoomView"

if any more clarification needed let me know.
Thank you for your help.

@Frank-Zhu
Copy link
Owner

@micheltabib you try this code

private void loadUserProfileView(){
    PullToZoomScrollViewEx scrollView = (PullToZoomScrollViewEx) findViewById(R.id.user_profile_scroll_view);
    View headView = LayoutInflater.from(this).inflate(R.layout.user_profile_header_view, null, false);
    View zoomView = LayoutInflater.from(this).inflate(R.layout.user_profile_zoom_view, null, false);
    View contentView = LayoutInflater.from(this).inflate(R.layout.user_profile_content_view, null, true);

    scrollView.setHeaderView(headView);
    scrollView.setZoomView(zoomView);
    scrollView.setScrollContentView(contentView);
    scrollView.setParallax(true);

    DisplayMetrics localDisplayMetrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(localDisplayMetrics);
    int mScreenHeight = localDisplayMetrics.heightPixels;
    int mScreenWidth = localDisplayMetrics.widthPixels;

    LinearLayout.LayoutParams localObject = new LinearLayout.LayoutParams(mScreenWidth, (int) (9.0F * (mScreenWidth / 16.0F)));
    scrollView.setHeaderLayoutParams(localObject);

    //This add code
    ViewGroup.LayoutParams params = zoomView.getLayoutParams();
    params.width = mScreenWidth;
    params.height = (int) (9.0F * (mScreenWidth / 16.0F));
    zoomView.setLayoutParams(params);
}

@Frank-Zhu
Copy link
Owner

@micheltabib can works?

@GrizzlyDoc
Copy link
Author

@Frank-Zhu thank you for your reply, but this solution didn't work.
in the XML ZoomView class, if i change android:scaleType to "fitXY" instead of "centerCrop", the layout works but the zooming when pulling down is wrong. the scaleType should be "centerCrop".

hope i was clear enough in my explanation.
thanks again

@GrizzlyDoc
Copy link
Author

hi Frank-Zhu
any new update about the parallalaxView library problem im facing?
thank you

On Mon, Jun 8, 2015 at 1:10 PM, 祝文武 [email protected] wrote:

@micheltabib https://github.com/micheltabib can works?


Reply to this email directly or view it on GitHub
#17 (comment)
.

Michel Tabib

@Frank-Zhu
Copy link
Owner

@micheltabib Give me your layout view code.I will try reproduction problems.
R.layout.user_profile_header_view
R.layout.user_profile_zoom_view
R.layout.user_profile_content_view

@GrizzlyDoc
Copy link
Author

hi
you may find attached the 3 xml layouts
thanks for your time.

Br,

On Wed, Jun 10, 2015 at 8:28 AM, 祝文武 [email protected] wrote:

@micheltabib https://github.com/micheltabib get me your layout view
code.I will try reproduction problems.
R.layout.user_profile_header_view
R.layout.user_profile_zoom_view
R.layout.user_profile_content_view


Reply to this email directly or view it on GitHub
#17 (comment)
.

Michel Tabib

@Frank-Zhu
Copy link
Owner

@micheltabib I am not reproduction this problems.This my code.

private void loadViewForCode() {
        PullToZoomScrollViewEx scrollView = (PullToZoomScrollViewEx) findViewById(R.id.scroll_view);
        View headView = LayoutInflater.from(this).inflate(R.layout.user_profile_header_view, null, false);
        ImageView zoomView = (ImageView) LayoutInflater.from(this).inflate(R.layout.profile_zoom_view, null, false);
        View contentView = LayoutInflater.from(this).inflate(R.layout.user_profile_content_view, null, false);

        scrollView.setHeaderView(headView);
        scrollView.setZoomView(zoomView);
        scrollView.setScrollContentView(contentView);
        scrollView.setParallax(true);

        Picasso.with(this).load("http://pica.nipic.com/2007-11-13/2007111317599808_2.jpg").into(zoomView);

        DisplayMetrics localDisplayMetrics = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(localDisplayMetrics);
        int mScreenHeight = localDisplayMetrics.heightPixels;
        int mScreenWidth = localDisplayMetrics.widthPixels;
        LinearLayout.LayoutParams localObject = new LinearLayout.LayoutParams(mScreenWidth, (int) (9.0F * (mScreenWidth / 16.0F)));
        scrollView.setHeaderLayoutParams(localObject);
    }

user_profile_header_view.xml

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="bottom"
    android:gravity="bottom">

    <ImageView
        android:id="@+id/iv_user_head"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:layout_margin="30dp"
        android:contentDescription="@string/app_name"
        android:src="@drawable/ic_img_user_default"/>
</FrameLayout>

profile_zoom_view.xml

<?xml version="1.0" encoding="utf-8"?>
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/iv_zoom"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:src="@drawable/ic_img_profile_bg"
    android:scaleType="centerCrop"
    android:layout_gravity="center_horizontal"
    android:contentDescription="@string/app_name" />

user_profile_content_view.xml

<?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:background="#cccccc"
    android:orientation="vertical">

    <TextView
        android:id="@+id/tv_test1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center_vertical"
        android:padding="20dp"
        android:text="test1"
        android:textSize="20sp"/>

    <TextView
        android:id="@+id/tv_test2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center_vertical"
        android:padding="20dp"
        android:text="test2"
        android:textSize="20sp"/>

    <TextView
        android:id="@+id/tv_test3"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center_vertical"
        android:padding="20dp"
        android:text="test3"
        android:textSize="20sp"/>

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center_vertical"
        android:padding="20dp"
        android:text="test4"
        android:textSize="20sp"/>
</LinearLayout>

screenshot_2015-06-11-15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants