我已经重新启动了Android Studio,缓存无效,已经同步了很多次。似乎什么都没用。我的主题或SDK是否有问题?
它在我的预览中仍然显示空白。我在Android 3.2.0-beta04上,并且我的gradle版本是4.6。请告诉我是否需要向此问题添加更多代码或信息。
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
defaultConfig {
applicationId "com.example.NAME.calculatorv2"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:23.4.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:design:23.4.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
content_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:showIn="@layout/activity_main"
tools:context=".MainActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@color/lightPureBlue">
<TextView
android:id="@+id/result_id"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:gravity="right|center_vertical"
android:hint="@string/base"
android:textSize="30sp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@color/pureBlue">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_gravity="center"
android:gravity="center"
android:paddingTop="10dp">
<Button
android:id="@+id/four"
style="?android:attr/borderlessButtonStyle"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="@+string/four"
android:textSize="30sp" />
<Button
android:id="@+id/five"
style="?android:attr/borderlessButtonStyle"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="@+string/five"
android:textSize="30sp" />
<Button
android:id="@+id/six"
style="?android:attr/borderlessButtonStyle"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="@+string/six"
android:textSize="30sp" />
<Button
android:id="@+id/subtract"
style="?android:attr/borderlessButtonStyle"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="@+string/subtract"
android:textSize="30sp" />
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@color/pureBlue">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_gravity="center"
android:gravity="center"
android:paddingTop="10dp">
<Button
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:id="@+id/one"
android:textSize="30sp"
android:text="@+string/one"
style="?android:attr/borderlessButtonStyle"/>
<Button
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:id="@+id/two"
android:textSize="30sp"
android:text="@+string/two"
style="?android:attr/borderlessButtonStyle"/>
<Button
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:id="@+id/three"
android:textSize="30sp"
android:text="@+string/three"
style="?android:attr/borderlessButtonStyle"/>
<Button
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:id="@+id/mul"
android:textSize="30sp"
android:text="@+string/mul"
style="?android:attr/borderlessButtonStyle"/>
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@color/pureBlue">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_gravity="center"
android:gravity="center"
android:paddingTop="10dp">
<Button
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:id="@+id/zero"
android:textSize="30sp"
android:text="@+string/zero"
style="?android:attr/borderlessButtonStyle"/>
<Button
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:id="@+id/clear"
android:textSize="30sp"
android:text="@+string/clear"
style="?android:attr/borderlessButtonStyle"/>
<Button
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:id="@+id/equal"
android:textSize="30sp"
android:text="@+string/equal"
style="?android:attr/borderlessButtonStyle"/>
<Button
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:id="@+id/div"
android:textSize="30sp"
android:text="@+string/div"
style="?android:attr/borderlessButtonStyle"/>
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:orientation="horizontal"
android:paddingTop="10dp">
<Button
android:id="@+id/seven"
style="?android:attr/borderlessButtonStyle"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="@+string/seven"
android:textSize="30sp" />
<Button
android:id="@+id/eight"
style="?android:attr/borderlessButtonStyle"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="@+string/eight"
android:textSize="30sp" />
<Button
android:id="@+id/nine"
style="?android:attr/borderlessButtonStyle"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="@+string/nine"
android:textSize="30sp" />
<Button
android:id="@+id/add"
style="?android:attr/borderlessButtonStyle"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="@+string/add"
android:textSize="30sp" />
</LinearLayout>