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

Ticket view not working inside ScrollView #25

Open
harshshinde07 opened this issue Nov 14, 2019 · 3 comments
Open

Ticket view not working inside ScrollView #25

harshshinde07 opened this issue Nov 14, 2019 · 3 comments

Comments

@harshshinde07
Copy link

Ticket view just disappears when you try to wrap it inside ScrollView

@vipulasri
Copy link
Owner

@harshshinde07 can you show me your xml layout?

@harshshinde07
Copy link
Author

@vipulasri Thanks for responding.

Here's the xml layout code.

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/colorBackground"
    tools:context="com.vipulasri.ticketview.sample.MainActivity">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/AppTheme.AppBarOverlay">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            app:popupTheme="@style/AppTheme.PopupOverlay" />

    </android.support.design.widget.AppBarLayout>

<ScrollView
    android:layout_width="match_parent"
    android:layout_marginTop="50dp"
    android:layout_height="match_parent">

    <android.support.v7.widget.CardView
        android:layout_width="match_parent"
        android:orientation="vertical"
        android:layout_height="wrap_content"
        android:layout_marginTop="20dp"
        android:layout_marginLeft="30dp"
        android:layout_marginRight="30dp"
        android:layout_marginBottom="20dp"
        app:cardBackgroundColor="@android:color/transparent"
        app:cardElevation="0dp"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

        <com.vipulasri.ticketview.TicketView
            android:id="@+id/ticketView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:ticketBorderColor="@color/colorAccent"
            app:ticketBackgroundColor="#ffffff"
            app:ticketBorderWidth="1dp"
            app:ticketCornerRadius="20dp"
            app:ticketCornerType="scallop"
            app:ticketDividerPadding="0dp"
            app:ticketDividerType="dash"
            app:ticketElevation="8dp"
            app:ticketOrientation="horizontal"
            app:ticketScallopPositionPercent="40"
            app:ticketScallopRadius="20dp"
            app:ticketShowBorder="false"
            app:ticketShowDivider="true" />

        <android.support.constraint.Guideline
            android:id="@+id/guideline"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            app:layout_constraintGuide_percent="0.4" />

        <LinearLayout
            android:id="@+id/linearLayout3"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:padding="10dp">

            <android.support.v7.widget.AppCompatImageView
                android:layout_width="200dp"
                android:layout_height="200dp"
                android:layout_gravity="center"
                android:scaleType="centerCrop"
                android:layout_weight="1"
                android:padding="16dp"
                android:layout_marginTop="4dp"
                app:srcCompat="@drawable/ic_qr_code" />

            <TextView
                android:id="@+id/orderIdentifier"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginBottom="@dimen/layout_margin_large"
                android:textColor="@color/black"
                android:layout_gravity="center"
                android:textSize="14sp"
                android:textAlignment="center"
                android:text="3267584639-23098239ds-239389qwsd923-qswd23"
                tools:text="3267584639-23098239ds-239389qwsd923-qswd23" />

            <TextView
                android:id="@+id/name"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginBottom="@dimen/layout_margin_large"
                android:textColor="#000000"
                android:textSize="@dimen/text_size_expanded_title_large"
                android:text="Name preview"
                android:layout_gravity="center"
                tools:text="Name preview" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Event"
                android:layout_marginTop="8dp"
                android:layout_gravity="center"
                android:textSize="@dimen/text_size_medium"
                tools:text="Event" />

            <TextView
                android:id="@+id/eventName"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginBottom="@dimen/layout_margin_large"
                android:text="Placeholder"
                android:layout_gravity="center"
                android:textColor="@color/black"
                android:textSize="@dimen/text_size_large"
                tools:text="Placeholder" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:baselineAligned="false"
                android:text="Check-in_status"
                android:layout_gravity="center"
                android:textSize="@dimen/text_size_medium"
                tools:text="Event" />

            <LinearLayout
                android:id="@+id/notCheckedInLayout"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginBottom="@dimen/layout_margin_large"
                android:orientation="horizontal">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Not_checked_in"
                    android:textColor="@color/black"
                    android:textSize="@dimen/text_size_large" />

                <View
                    android:layout_width="@dimen/card_tickets_radius"
                    android:layout_height="@dimen/card_tickets_radius"
                    android:layout_marginTop="@dimen/layout_margin_extra_small"
                    app:tint="@android:color/holo_red_light" />

            </LinearLayout>

            <TextView
                android:layout_gravity="center"
                android:id="@+id/notAvailableTextView"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginBottom="@dimen/layout_margin_large"
                android:text="Not_available"
                android:textSize="@dimen/text_size_large"
                android:visibility="gone"/>



            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="@dimen/layout_margin_large"
                android:orientation="horizontal"
                android:weightSum="2">

                <LinearLayout
                    android:layout_width="@dimen/layout_margin_none"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:orientation="vertical"
                    android:paddingTop="@dimen/layout_margin_medium"
                    android:paddingRight="@dimen/layout_margin_medium"
                    android:layout_marginStart="16dp"
                    android:paddingBottom="@dimen/layout_margin_medium"
                    android:paddingEnd="@dimen/layout_margin_medium"
                    android:layout_marginLeft="16dp">

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/date"
                        android:textSize="@dimen/text_size_medium"
                        tools:text="@string/date" />

                    <TextView
                        android:id="@+id/date"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:textColor="@color/black"
                        android:textSize="@dimen/text_size_medium"
                        android:text="Thu, June 14"
                        tools:text="Thu, June 14" />

                    <TextView
                        android:id="@+id/calendar"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Add_to_calendar"
                        android:textColor="@color/colorAccent"
                        android:background="?selectableItemBackground"
                        android:paddingTop="@dimen/padding_small"
                        android:paddingBottom="@dimen/padding_small"
                        android:textSize="@dimen/text_size_medium"
                        tools:text="Add_to_calendar" />
                </LinearLayout>

                <LinearLayout
                    android:layout_width="@dimen/layout_margin_none"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:orientation="vertical"
                    android:padding="@dimen/layout_margin_medium">

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="location"
                        android:textSize="@dimen/text_size_medium"
                        tools:text="location" />

                    <TextView
                        android:id="@+id/location"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:textColor="@color/black"
                        android:text="Placeholder"
                        android:textSize="@dimen/text_size_medium"
                        tools:text="Placeholder" />

                    <TextView
                        android:id="@+id/map"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="see_maps"
                        android:background="?selectableItemBackground"
                        android:paddingTop="@dimen/padding_small"
                        android:paddingBottom="@dimen/padding_small"
                        android:textColor="@color/colorAccent"
                        android:textSize="@dimen/text_size_medium"
                        tools:text="see_maps" />
                </LinearLayout>

            </LinearLayout>

            <View
                android:layout_width="match_parent"
                android:layout_marginTop="@dimen/layout_margin_small"
                android:layout_marginBottom="@dimen/layout_margin_small"
                android:layout_height="1.2dp"
                android:background="@color/black" />


            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="event_summary"
                android:textSize="@dimen/text_size_medium"
                android:layout_marginStart="16dp"
                android:layout_marginLeft="16dp" />

            <TextView
                android:id="@+id/eventSummary"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:ellipsize="end"
                android:maxLines="2"
                android:layout_marginStart="16dp"
                android:layout_marginLeft="16dp"
                android:textColor="@color/black"
                android:textSize="@dimen/text_size_large"
                android:text="Event Summary Preview"
                tools:text="event_summary_preview" />

            <TextView
                android:id="@+id/eventDetails"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginBottom="@dimen/layout_margin_large"
                android:text="Event_details"
                android:layout_marginStart="16dp"
                android:layout_marginLeft="16dp"
                android:textColor="@color/colorAccent"
                android:textSize="@dimen/text_size_medium"
                android:paddingBottom="@dimen/padding_small"
                android:paddingTop="@dimen/padding_small"
                tools:text="Event_details" />

            <TextView
                android:id="@+id/organizerLabel"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Placeholder"
                android:layout_marginStart="16dp"
                android:layout_marginLeft="16dp"
                android:textSize="@dimen/text_size_medium"
                tools:text="Placeholder" />

            <TextView
                android:id="@+id/organizer"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textColor="@color/black"
                android:textSize="@dimen/text_size_large"
                android:text="Placeholder"
                android:layout_marginStart="16dp"
                android:layout_marginLeft="16dp"
                tools:text="Placeholder" />

            <Button
                android:id="@+id/downloadButton"
                style="@style/Widget.AppCompat.Button.Colored"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/padding_large"
                android:layout_marginBottom="@dimen/padding_large"
                android:enabled="true"
                android:text="Download_ticket" />

        </LinearLayout>

    </android.support.v7.widget.CardView>
</ScrollView>

</android.support.design.widget.CoordinatorLayout>

Please let me know where I'm doing it wrong.
Thanks!

@RithyP
Copy link

RithyP commented Jan 6, 2023

Are there any solutions for this issue yet? I also encounter the same issues when I wrapped the TicketView inside a NestedScrollView or the TicketView get too big.

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

3 participants