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

Custom Slide Fragment - Landscape layout doesn't work properly #101

Closed
addrum opened this issue Jul 18, 2016 · 5 comments
Closed

Custom Slide Fragment - Landscape layout doesn't work properly #101

addrum opened this issue Jul 18, 2016 · 5 comments
Assignees
Milestone

Comments

@addrum
Copy link

addrum commented Jul 18, 2016

Not sure if this is the xml I have set up, but I copied your layout-land fragment slide example to use with a custom Slide Fragment and it doesn't display correctly at all. See image and xml below. Please let me know if this is my end.

image

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              xmlns:tools="http://schemas.android.com/tools"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:baselineAligned="false"
              android:clipToPadding="false"
              android:fitsSystemWindows="false"
              android:padding="@dimen/mi_baseline">

    <ImageView
        android:id="@id/mi_image"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_weight="1"
        android:gravity="center"
        tools:ignore="ContentDescription"
        tools:src="@mipmap/ic_launcher"/>

    <android.support.v4.widget.Space
        android:layout_width="@dimen/mi_baseline"
        android:layout_height="wrap_content"/>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:gravity="center"
        android:orientation="vertical">

        <TextView
            android:id="@id/mi_title"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:fontFamily="sans-serif-medium"
            android:gravity="center"
            android:textAppearance="@style/TextAppearance.AppCompat.Headline"
            tools:ignore="UnusedAttribute"
            tools:text="@string/updateCheckFrequency"/>

        <TextView
            android:id="@id/mi_description"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/mi_baseline"
            android:gravity="center"
            android:textAppearance="@style/TextAppearance.AppCompat.Subhead"
            tools:text="@string/slide3Desc"/>

        <Spinner
            android:id="@+id/updateFrequencySpinner"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/mi_baseline"
            android:gravity="center"
            android:prompt="@string/updateCheckFrequency"
            android:textAppearance="@style/TextAppearance.AppCompat.Subhead">
        </Spinner>

    </LinearLayout>

</LinearLayout>
@addrum
Copy link
Author

addrum commented Jul 18, 2016

This works with a different slidefragment however.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              xmlns:tools="http://schemas.android.com/tools"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:baselineAligned="false"
              android:clipToPadding="false"
              android:fitsSystemWindows="false"
              android:padding="@dimen/mi_baseline">

    <ImageView
        android:id="@id/mi_image"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_weight="1"
        android:gravity="center"
        tools:ignore="ContentDescription"
        android:src="@mipmap/ic_launcher"/>

    <android.support.v4.widget.Space
        android:layout_width="@dimen/mi_baseline"
        android:layout_height="wrap_content"/>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:gravity="center"
        android:orientation="vertical">

        <TextView
            android:id="@+id/locationPermissionSlideTitle"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/mi_baseline"
            android:fontFamily="sans-serif-medium"
            android:gravity="center"
            android:text="@string/slide4Title"
            android:textAppearance="@style/TextAppearance.AppCompat.Headline"
            tools:ignore="UnusedAttribute"/>

        <TextView
            android:id="@+id/slide4DescLabel"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/mi_baseline"
            android:gravity="center"
            android:text="@string/slide4Desc"
            android:textAppearance="@style/TextAppearance.AppCompat.Subhead"
            android:textColor="#b3ffffff"
            tools:ignore="UnusedAttribute"/>

    </LinearLayout>

</LinearLayout>

@heinrichreimer
Copy link
Owner

I guess you mixed up the android and tools namespace in your XML.
The tools attributes are just for the layout editor and get stripped out on build time.
If e.g. you want to display your launcher icon in this custom slide you should use android:src="@mipmap/ic_launcher" on your ImageView, not tools:src="@mipmap/ic_launcher".
Hope that helps.

@addrum
Copy link
Author

addrum commented Jul 18, 2016

Thanks. I also just recreated the xml by copying one that worked and it seemed to fix it. I'll close this as it's a non issue.

@addrum addrum closed this as completed Jul 18, 2016
@heinrichreimer
Copy link
Owner

Have you tried replacing tools by android in the code you sent me?

@addrum
Copy link
Author

addrum commented Jul 18, 2016

Yes, that fixed it.

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

No branches or pull requests

2 participants