Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LinearLayout flagged if used in CardView

I have used a LinearLayout in a CardView to get a kind of social media login button look and it all runs fine, but Android Studio flags Element LinearLayout is not allowed here. I was wondering why this may be the case? My xml is this :

<android.support.v7.widget.CardView
            xmlns:card_view="http://schemas.android.com/apk/res-auto"
            android:layout_below="@id/cv_fb"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            card_view:cardElevation="3dp"
            >

            <LinearLayout

                android:id="@+id/ll_entitlement_extend_google"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:background="@color/white"
                android:clickable="true"
                android:gravity="center"
                android:paddingTop="10dp"
                android:paddingBottom="10dp"
                >

                <ImageView
                    android:layout_weight="1"
                    android:layout_width="75dp"
                    android:layout_height="75dp"
                    android:src="@drawable/google_icon"/>

                <TextView
                    android:layout_weight="1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Connect with Google +"/>

                <ImageView
                    android:layout_weight="1"
                    android:layout_width="25dp"
                    android:layout_height="25dp"
                    android:src="@drawable/ic_chevron_right_black"/>


            </LinearLayout>
        </android.support.v7.widget.CardView>
like image 861
AmaJayJB Avatar asked Dec 12 '14 09:12

AmaJayJB


People also ask

How do you declare a LinearLayout?

To create a linear layout in which each child uses the same amount of space on the screen, set the android:layout_height of each view to "0dp" (for a vertical layout) or the android:layout_width of each view to "0dp" (for a horizontal layout). Then set the android:layout_weight of each view to "1" .

What is LinearLayout?

LinearLayout is the most basic layout in android studio, that aligns all the children sequentially either in a horizontal manner or a vertical manner by specifying the android:orientation attribute.

What is CardView in Android with example?

CardView is a new widget in Android that can be used to display any sort of data by providing a rounded corner layout along with a specific elevation. CardView is the view that can display views on top of each other. The main usage of CardView is that it helps to give a rich feel and look to the UI design.

How to implement CardView in android?

To set the corner radius in your layouts, use the card_view:cardCornerRadius attribute. To set the corner radius in your code, use the CardView. setRadius method. To set the background color of a card, use the card_view:cardBackgroundColor attribute.


1 Answers

Just to have a proper answer, as @Blacklight said in comments, it is an IDE issue so restarting it should fix the problem.

like image 98
Benoit Duffez Avatar answered Oct 20 '22 01:10

Benoit Duffez