我刚刚将我的代码从Android Studio切换到IntelliJ,并且由于某种原因让它再次运行时遇到了一些麻烦。 我看到一些类似的问题都指向了错误的API级别。 我已将我的设置设置为API级别23,并且设备设置为Nexus 6.
我已经尝试过无效缓存并重新启动,显然检查我有正确的API级别设置,但无济于事。
关于我在这里缺少什么的想法?
当我尝试运行我的应用时,我遇到了这些错误:
Rendering Problems
NOTE: One or two more layouts are missing the layout_width or layout_height attributes.
在设计渲染窗口中:
<?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="com.example.richardcurteis.connect3.MainActivity"
tools:showIn="@layout/activity_main"
android:background="#070000">
<TableLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentRight="false"
android:layout_alignParentEnd="false"
android:layout_alignParentStart="false"
android:layout_centerInParent="true"
android:id="@+id/tableLayout"
android:background="#000000">
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"></TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"></TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"></TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"></TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"></TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"></TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"></TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"></TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"></TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"></TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:layout_width="100dp"
android:layout_height="100dp"
android:id="@+id/gridButton1"
android:layout_column="4"
android:onClick="receiveClick"
android:tag="0"/>
<Button
android:layout_width="100dp"
android:layout_height="100dp"
android:id="@+id/gridButton2"
android:layout_column="12"
android:onClick="receiveClick"
android:tag="1" />
<Button
android:layout_width="100dp"
android:layout_height="100dp"
android:id="@+id/gridButton3"
android:layout_column="19"
android:onClick="receiveClick"
android:tag="2" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"></TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"></TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"></TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:layout_width="100dp"
android:layout_height="100dp"
android:id="@+id/gridButton4"
android:layout_column="4"
android:onClick="receiveClick"
android:tag="3"/>
<Button
android:layout_width="100dp"
android:layout_height="100dp"
android:id="@+id/gridButton5"
android:layout_column="12"
android:onClick="receiveClick"
android:tag="4"/>
<Button
android:layout_width="100dp"
android:layout_height="100dp"
android:id="@+id/gridButton6"
android:layout_column="19"
android:onClick="receiveClick"
android:tag="5"/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"></TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"></TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"></TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:layout_width="100dp"
android:layout_height="100dp"
android:id="@+id/gridButton7"
android:layout_column="4"
android:onClick="receiveClick"
android:tag="6"/>
<Button
android:layout_width="100dp"
android:layout_height="100dp"
android:id="@+id/gridButton8"
android:layout_column="12"
android:onClick="receiveClick"
android:tag="7"/>
<Button
android:layout_width="100dp"
android:layout_height="100dp"
android:id="@+id/gridButton9"
android:layout_column="19"
android:onClick="receiveClick"
android:tag="8" />
</TableRow>
</TableLayout>
<Button
android:layout_width="200dp"
android:layout_height="120dp"
android:text="New Game"
android:id="@+id/newGameButton"
android:layout_below="@+id/tableLayout"
android:layout_centerHorizontal="true"
android:layout_marginTop="61dp" />
</RelativeLayout>
大多数布局都需要这些。
XML:
GetElement