简体   繁体   中英

Android Studio 3.1.3

I started programming on Android Studio for a few weeks and i'm doing a project, I can not open the programs i have created, every time I try to open a program on my cell phone it closes itself, I do not know why, I tried to create new layouts but it doesn't work. I need help. I use Android Studio 3.1.3 API 26. My phone uses API 22.

<?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"
tools:context=".MenuInicial"
android:orientation="vertical"
android:padding="5dp"
android:background="@color/background"
tools:ignore="ExtraText">

<LinearLayout
    android:gravity="center"
    android:clipToPadding="false"
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <android.support.v7.widget.CardView
        android:foreground="?android:attr/selectableItemBackground"
        android:clickable="true"
        android:focusable="true"
        android:layout_width="155dp"
        android:layout_height="150dp"
        android:layout_margin="10dp">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical"
            android:gravity="center">
            <ImageView
                android:layout_width="64dp"
                android:layout_height="64dp"
                android:background="@drawable/backgroudpurpura"
                android:src="@drawable/ic_attach_file_black_24dp"
                android:padding="10dp"/>
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textStyle="bold"
                android:layout_margin="10dp"
                android:text="Link"/>
            <view
                android:layout_width="match_parent"
                android:layout_height="1dp"
                android:background="@color/lightgreySinza"
                android:layout_margin="2dp">
            </view>
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:text="lista de vompras rancho"
                android:padding="3dp"
                android:textColor="@color/darkgrey"/>
        </LinearLayout>
    </android.support.v7.widget.CardView>

    <android.support.v7.widget.CardView
        android:foreground="?android:attr/selectableItemBackground"
        android:clickable="true"
        android:focusable="true"
        android:layout_width="155dp"
        android:layout_height="150dp"
        android:layout_margin="10dp">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical"
            android:gravity="center">
            <ImageView
                android:layout_width="64dp"
                android:layout_height="64dp"
                android:background="@drawable/backgroudverde"
                android:src="@drawable/ic_control_point_black_24dp"
                android:padding="10dp"/>
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textStyle="bold"
                android:layout_margin="10dp"
                android:text="Link"/>
            <view
                android:layout_width="match_parent"
                android:layout_height="1dp"
                android:background="@color/lightgreySinza"
                android:layout_margin="2dp">
            </view>
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:text="lista de vompras rancho"
                android:padding="3dp"
                android:textColor="@color/darkgrey"/>
        </LinearLayout>
    </android.support.v7.widget.CardView>

</LinearLayout>

<LinearLayout
    android:gravity="center"
    android:clipToPadding="false"
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <android.support.v7.widget.CardView
        android:foreground="?android:attr/selectableItemBackground"
        android:clickable="true"
        android:layout_width="155dp"
        android:layout_height="150dp"
        android:layout_margin="10dp">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical"
            android:gravity="center">
            <ImageView
                android:layout_width="64dp"
                android:layout_height="64dp"
                android:background="@drawable/backgroudamarelo"
                android:src="@drawable/ic_content_paste_black_24dp"
                android:padding="10dp"/>
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textStyle="bold"
                android:layout_margin="10dp"
                android:text="Link"/>
            <view
                android:layout_width="match_parent"
                android:layout_height="1dp"
                android:background="@color/lightgreySinza"
                android:layout_margin="2dp">
            </view>
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:text="lista de vompras rancho"
                android:padding="3dp"
                android:textColor="@color/darkgrey"/>
        </LinearLayout>
    </android.support.v7.widget.CardView>

    <android.support.v7.widget.CardView
        android:foreground="?android:attr/selectableItemBackground"
        android:clickable="true"
        android:layout_width="155dp"
        android:layout_height="150dp"
        android:layout_margin="10dp">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical"
            android:gravity="center">
            <ImageView
                android:layout_width="64dp"
                android:layout_height="64dp"
                android:background="@drawable/backgroudrosa"
                android:src="@drawable/ic_collections_bookmark_black_24dp"
                android:padding="10dp"/>
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textStyle="bold"
                android:layout_margin="10dp"
                android:text="Link"/>
            <view
                android:layout_width="match_parent"
                android:layout_height="1dp"
                android:background="@color/lightgreySinza"
                android:layout_margin="2dp">
            </view>
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:text="lista de vompras rancho"
                android:padding="3dp"
                android:textColor="@color/darkgrey"/>
        </LinearLayout>
    </android.support.v7.widget.CardView>

</LinearLayout>

<LinearLayout
    android:gravity="center"
    android:clipToPadding="false"
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <android.support.v7.widget.CardView
        android:foreground="?android:attr/selectableItemBackground"
        android:clickable="true"
        android:layout_width="340dp"
        android:layout_height="140dp"
        android:layout_margin="10dp">
        +<LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical"
            android:gravity="center">
            <ImageView
                android:layout_width="64dp"
                android:layout_height="64dp"
                android:background="@drawable/backgroundblue"
                android:src="@drawable/ic_wifi_black_24dp"
                android:padding="10dp"/>
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textStyle="bold"
                android:layout_margin="10dp"
                android:text="Link"/>
            <view
                android:layout_width="match_parent"
                android:layout_height="1dp"
                android:background="@color/lightgreySinza"
                android:layout_margin="2dp">
            </view>
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:text="lista de vompras rancho"
                android:padding="3dp"
                android:textColor="@color/darkgrey"/>
        </LinearLayout>
    </android.support.v7.widget.CardView>

</LinearLayout>

I believe this may be the problem

<view
                android:layout_width="match_parent"
                android:layout_height="1dp"
                android:background="@color/lightgreySinza"
                android:layout_margin="2dp">
            </view>

what is <view> ?

also delete this + sign

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM