Avd显示我的应用程序的旧版本

时间:2018-06-16 08:09:06

标签: android avd

所以我在我的应用程序中进行了一些更改(它是关于嵌套布局 - 我的根布局,线性布局,我想将其更改为相对布局,我记得,像xlmns这样的行有问题:工具我从我之前的应用程序中复制了这些行,但后来我发现了一些错误,所以我谷歌了,有人写了关于删除.idea和.gradle文件夹,所以我做了,现在,我avd在一些变化之前向我展示了“旧内容”只是应用程序。我如何解决它?我试图制作的应用程序,它只是我课程中的典型点击器。它将计算两个团队的得分。屏幕问题https://imgur.com/a/U9gianT

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
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_height="match_parent"
android:layout_width="match_parent">

<Button
    android:layout_gravity="center"
    android:id="@+id/reset_score"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/resetBTN"
    android:layout_marginTop="15dp"
    android:onClick="reset_score"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"
    android:layout_marginBottom="32dp"
    />

android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">

<LinearLayout
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:orientation="vertical">

    <TextView
        android:layout_gravity="center"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/team_a"
        android:textSize="14sp"
        android:textColor="#616161"
        android:fontFamily="sans-serif-medium"
        android:layout_marginTop="16dp"/>

    <TextView
        android:layout_gravity="center"
        android:id="@+id/team_a_points"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/team_a_points"
        android:layout_marginTop="16dp"
        android:textColor="#000000"
        android:fontFamily="sans-serif-light"
        android:textSize="56sp"/>

    <Button
        android:layout_gravity="center"
        android:id="@+id/three_points_a"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/_3_points_btn"
        android:layout_marginTop="24dp"
        android:onClick="addThreePointsA"/>

    <Button
        android:layout_gravity="center"
        android:id="@+id/two_points_a"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/_2_points_btn"
        android:layout_marginTop="24dp"
        android:onClick="addTwoPointsA"/>

    <Button
        android:layout_gravity="center"
        android:id="@+id/free_throw_a"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/free_throw_btn"
        android:layout_marginTop="24dp"
        android:onClick="addOnePointA"/>

</LinearLayout>

<View
    android:layout_width="1dp"
    android:layout_height="340dp"
    android:background="@android:color/darker_gray"
    android:layout_marginTop="15dp"/>

<LinearLayout
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:orientation="vertical"
    >

    <TextView
        android:layout_marginTop="16dp"
        android:layout_gravity="center"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/team_b"
        android:textSize="14sp"
        android:textColor="#616161"
        android:fontFamily="sans-serif-medium"/>

    <TextView

        android:layout_gravity="center"
        android:id="@+id/team_b_points"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/team_b_score"
        android:layout_marginTop="16dp"
        android:textSize="56sp"
        android:textColor="#000000"
        android:fontFamily="sans-serif-light"/>

    <Button
        android:layout_gravity="center"
        android:id="@+id/three_points_b"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/_3_points_btn"
        android:layout_marginTop="24dp"
        android:onClick="addThreePointsB"/>

    <Button
        android:layout_gravity="center"
        android:id="@+id/two_points_b"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/_2_points_btn"
        android:layout_marginTop="24dp"
        android:onClick="addTwoPointsB"/>

    <Button
        android:layout_gravity="center"
        android:id="@+id/free_throw_b"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/free_throw_btn"
        android:layout_marginTop="24dp"
        android:onClick="addOnePointB"/>
</LinearLayout>

package com.example.kacper.courtcounter;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
}
int team_a_score = 0;
int team_b_score = 0;

private void display_a_score(int score){
    TextView scoreView = (TextView) findViewById(R.id.team_a_points);
    scoreView.setText(String.valueOf(score));
}

private void display_b_score(int score){
    TextView scoreView = (TextView) findViewById(R.id.team_b_points);
    scoreView.setText(String.valueOf(score));
}

public void addThreePointsA(View view) {
    team_a_score = team_a_score+3;
    display_a_score(team_a_score);
}

public void addTwoPointsA(View view) {
    team_a_score = team_a_score+2;
    display_a_score(team_a_score);
}

public void addOnePointA(View view) {
    team_a_score = team_a_score+1;
    display_a_score(team_a_score);
}


public void addThreePointsB(View view) {
    team_b_score = team_b_score+3;
    display_b_score(team_b_score);
}

public void addTwoPointsB(View view) {
    team_b_score = team_b_score+2;
    display_b_score(team_b_score);
}

public void addOnePointB(View view) {
    team_b_score = team_b_score+1;
    display_b_score(team_b_score);
}

public void reset_score(View view) {
    team_a_score = 0;
    team_b_score = 0;
    display_a_score(team_a_score);
    display_b_score(team_b_score);
}
}

1 个答案:

答案 0 :(得分:0)

只需Cleanrebuild您的项目,然后从设备中卸载应用然后再次在设备中运行它将正常工作(如果您真的在代码中进行了更改)< / p>