0

Pessoal comecei a fazer minha aplicação, mas esqueci de colocar um scrollbar para ela deslizar. Resultado, os cardview passaram da tela. Já tentei adicionar a tag ScrollView no começo mas não dá certo.

Será que vou ter que refazer tudo do zero com Fragments ?

<?xml version="1.0" encoding="utf-8"?>

android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.jnior.decorus.DetalhesCatalogo">


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
    android:id="@+id/linearLayout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <android.support.v7.widget.CardView
        android:id="@+id/card_view8a6"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_margin="5dp"
        android:background="@color/colorPrimaryDark"
        android:paddingBottom="@dimen/activity_vertical_margin"
        card_view:cardCornerRadius="2dp"
        card_view:contentPadding="10dp">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">


            <ImageView
                android:id="@+id/imageView2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_alignParentStart="true"
                android:layout_centerVertical="true"
                android:src="@mipmap/user_clientes" />

            <TextView
                android:id="@+id/textView32"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true"
                android:layout_marginLeft="19dp"
                android:layout_marginStart="19dp"
                android:layout_toEndOf="@+id/imageView2"
                android:layout_toRightOf="@+id/imageView2"
                android:text="@string/cliente"
                android:textAppearance="?android:attr/textAppearanceLarge" />


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

    <android.support.v7.widget.CardView
        android:id="@+id/card_view8"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_margin="5dp"
        android:background="@color/colorPrimaryDark"
        android:paddingBottom="@dimen/activity_vertical_margin"
        card_view:cardCornerRadius="2dp"
        card_view:contentPadding="10dp">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">


            <ImageView
                android:id="@+id/imageView2a"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_alignParentStart="true"
                android:layout_centerVertical="true"
                android:src="@mipmap/ic_data" />

            <TextView
                android:id="@+id/textView32a"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true"
                android:layout_marginLeft="19dp"
                android:layout_marginStart="19dp"
                android:layout_toEndOf="@+id/imageView2a"
                android:layout_toRightOf="@+id/imageView2a"
                android:text="@string/data"
                android:textAppearance="?android:attr/textAppearanceLarge" />


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

    <TextView
        android:id="@+id/textView33"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_below="@+id/linearLayout"
        android:layout_margin="5dp"
        android:text="@string/item"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <android.support.v7.widget.CardView
        android:id="@+id/card_view8a"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_margin="5dp"
        android:background="@color/colorPrimaryDark"
        android:paddingBottom="@dimen/activity_vertical_margin"
        card_view:cardCornerRadius="2dp"
        card_view:contentPadding="10dp">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">


            <TextView
                android:id="@+id/textView32aa"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true"
                android:layout_marginLeft="19dp"
                android:layout_marginStart="19dp"
                android:text="@string/add_itens"
                android:textAppearance="?android:attr/textAppearanceLarge" />

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


    <android.support.v7.widget.CardView
        android:id="@+id/card_view_1"
        android:layout_width="fill_parent"
        android:layout_height="180dp"
        android:layout_gravity="center"
        android:layout_margin="5dp"
        card_view:cardCornerRadius="2dp"
        card_view:contentPadding="10dp">

        <RelativeLayout
            android:id="@+id/Vendas"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent">

            <ImageView
                android:id="@+id/imageView"
                android:layout_width="130dp"
                android:layout_height="95dp"
                android:layout_alignParentBottom="true"
                android:layout_alignParentLeft="true"
                android:layout_alignParentStart="true"
                android:layout_alignParentTop="true"
                android:src="@mipmap/top" />

            <TextView
                android:id="@+id/textView12"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentTop="true"
                android:layout_toEndOf="@+id/imageView"
                android:layout_toRightOf="@+id/imageView"
                android:text="Polpa Hidratante para Mãos e Unhas Castanha Ekos"
                android:textAppearance="?android:attr/textAppearanceMedium" />

            <TextView
                android:id="@+id/textView13"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignBaseline="@+id/textView30"
                android:layout_alignBottom="@+id/textView30"
                android:layout_toEndOf="@+id/imageView"
                android:layout_toRightOf="@+id/imageView"
                android:text="Ref: 294411"
                android:textAppearance="?android:attr/textAppearanceSmall" />

            <TextView
                android:id="@+id/textView29"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignBottom="@+id/imageView"
                android:layout_toEndOf="@+id/imageView"
                android:layout_toRightOf="@+id/imageView"
                android:text="Pág.: 53"
                android:textAppearance="?android:attr/textAppearanceSmall" />

            <TextView
                android:id="@+id/textView31"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentEnd="true"
                android:layout_alignParentRight="true"
                android:layout_alignTop="@+id/textView29"
                android:text="Preço: 185,00"
                android:textAppearance="?android:attr/textAppearanceSmall" />

            <TextView
                android:id="@+id/textView30"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_above="@+id/textView31"
                android:layout_alignParentEnd="true"
                android:layout_alignParentRight="true"
                android:text="600 ml"
                android:textAppearance="?android:attr/textAppearanceSmall" />

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

    <TextView
        android:id="@+id/textView33aa"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_below="@+id/linearLayout"
        android:layout_margin="5dp"
        android:text="@string/valores"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <android.support.v7.widget.CardView
        android:id="@+id/card_view_16"
        android:layout_width="fill_parent"
        android:layout_height="180dp"
        android:layout_gravity="center"
        android:layout_margin="5dp"
        card_view:cardCornerRadius="2dp"
        card_view:contentPadding="10dp">

        <RelativeLayout
            android:id="@+id/Vendas6"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent">

            <ImageView
                android:id="@+id/imageView6"
                android:layout_width="130dp"
                android:layout_height="95dp"
                android:layout_alignParentBottom="true"
                android:layout_alignParentLeft="true"
                android:layout_alignParentStart="true"
                android:layout_alignParentTop="true"
                android:src="@mipmap/top" />

            <TextView
                android:id="@+id/textView126"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentTop="true"
                android:layout_toEndOf="@+id/imageView6"
                android:layout_toRightOf="@+id/imageView6"
                android:text="Polpa Hidratante para Mãos e Unhas Castanha Ekos"
                android:textAppearance="?android:attr/textAppearanceMedium" />

            <TextView
                android:id="@+id/textView136"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignBaseline="@+id/textView306"
                android:layout_alignBottom="@+id/textView306"
                android:layout_toEndOf="@+id/imageView6"
                android:layout_toRightOf="@+id/imageView6"
                android:text="Ref: 294411"
                android:textAppearance="?android:attr/textAppearanceSmall" />

            <TextView
                android:id="@+id/textView296"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignBottom="@+id/imageView6"
                android:layout_toEndOf="@+id/imageView6"
                android:layout_toRightOf="@+id/imageView6"
                android:text="Pág.: 53"
                android:textAppearance="?android:attr/textAppearanceSmall" />

            <TextView
                android:id="@+id/textView316"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentEnd="true"
                android:layout_alignParentRight="true"
                android:layout_alignTop="@+id/textView296"
                android:text="Preço: 185,00"
                android:textAppearance="?android:attr/textAppearanceSmall" />

            <TextView
                android:id="@+id/textView306"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_above="@+id/textView316"
                android:layout_alignParentEnd="true"
                android:layout_alignParentRight="true"
                android:text="600 ml"
                android:textAppearance="?android:attr/textAppearanceSmall" />

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


</LinearLayout>

0

1 Resposta 1

1

Adicione o seguinte código acima da primeira tag LinearLayout

<ScrollView android:layout_height="match_parent"
android:layout_width="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
app:layout_behavior="@string/appbar_scrolling_view_behavior">

E feche as tags no final do código

</ScrollView>
4
  • Não deu certo Leonardo. Fiz o que você sugeriu e mesmo assim não deu certo o Scroll. Commented 14/06/2016 às 19:21
  • tenta retirar essa parte do código android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.example.jnior.decorus.DetalhesCatalogo"> Commented 14/06/2016 às 19:27
  • Vou tentar em casa. Depois de falo. Valeu Commented 14/06/2016 às 19:32
  • Leonardo, tentei ontem e consegui assim como você mostrou. Muito obrigado pela ajuda. Commented 15/06/2016 às 10:22

Você deve fazer log-in para responder a esta pergunta.

Esta não é a resposta que você está procurando? Pesquise outras perguntas com a tag .