【发布时间】:2016-02-24 11:20:52
【问题描述】:
编辑
我使用 E-Clips 作为我的 IDE 来开发安卓程序。 我打算迁移到 Android Studio,所以我对这个 IDE 真的很陌生。
安装 Android Studio 后,当我尝试创建新项目时,我选择 API 15 (android 4.0.3) 并为 Activity Page 我选择空白主题。
当项目打开并 gradle 完成同步时,设计选项卡上的 XML 页面不显示任何内容并且没有错误。
在我将渲染目标更改为 API 15 后,出现以下消息:
这是我的 xml 文件中的内容,请注意我在创建项目时没有更改默认代码。
<?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_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="test.apptune.ir.stack.MainActivity"
tools:showIn="@layout/activity_main">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!" />
</RelativeLayout>
这是我的 biuld.gradle :
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "test.apptune.ir.stack"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:design:22.2.1'
}
如果您在这方面帮助我,我将不胜感激。
【问题讨论】:
-
添加您的 build.gradle... 您缺少的一些库
标签: android xml android-studio layout