Reputation:
I have restarted Android Studio, I have invalidated caches, I have Synced many times.. Nothing seems to work at all. Is there a problem with my Theme or my SDK?
It still shows blank on my preview. I am on Android 3.2.0-beta04 and my gradle version is 4.6. Please tell me if I need to add more code or information to this question.
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>
Upvotes: 0
Views: 59
Reputation: 11
I recently had similar problem. What helped me was changing the app theme. In your case it seems to be "NoActionBar". Try changing it to Material or Light.
Here is an animation of the procedure
Upvotes: 1