预览模式在android studio的设计选项卡中没有显示任何In设备预览?

时间:2016-09-29 05:36:35

标签: android android-studio

我刚刚更新了我的安卓工作室并面对这个问题:
这就是我在设计选项卡中获得的预览中没有任何设备无法访问API级别 在此输入图片说明 主题选择只显示了这一点,右侧没有描述

activity_main的文本部分包含:

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/activity_main"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin"
        android:paddingBottom="@dimen/activity_vertical_margin"
        tools:context="com.example.akash.myapplicationddd.MainActivity">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hello World!" />
</RelativeLayout>

这是我的gradle(项目):

    buildscript {
    repositories {
        jcenter()
    }
dependencies {
    classpath 'com.android.tools.build:gradle:2.2.0'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }  
}

任务清理(类型:删除){         删除rootProject.buildDir enter code here    }

1 个答案:

答案 0 :(得分:0)

请更改您的gradle文件

    selectionTab = bundle.getInt("selectionTab");
    tabLayout.getTabAt(selectionTab).select();                
tabLayout.getTabAt(selectionTab).getCustomView().setSelected(true);

更改为您更新的工作室版本