Android Can';t解决错误-视图需要API级别14(当前最小值为8):<;网格布局>;
我的代码是-Android Can';t解决错误-视图需要API级别14(当前最小值为8):<;网格布局>;,android,android-layout,android-gridlayout,Android,Android Layout,Android Gridlayout,我的代码是- <GridLayout xmlns:android= "http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:columnCount="4" android:orientation="horizontal" >
<GridLayout
xmlns:android= "http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:columnCount="4"
android:orientation="horizontal" >
<Button android:text="@string/btn7" />
<Button android:text="@string/btn8" />
<Button android:text="@string/btn9" />
<Button android:text="@string/btndiv" />
<Button android:text="@string/btn4" />
<Button android:text="@string/btn5" />
<Button android:text="@string/btn6" />
<Button android:text="@string/btnmul" />
<Button android:text="@string/btn1" />
<Button android:text="@string/btn2" />
<Button android:text="@string/btn3" />
<Button android:text="@string/btnmin" />
<Button android:text="@string/btn00" />
<Button android:text="@string/btn0" />
<Button android:text="@string/btndec" />
<Button android:text="@string/btnadd" />
<Button android:text="@string/btnsqrt" />
<Button android:text="@string/btncbrt" />
<Button android:text="@string/btnrec" />
<Button
android:layout_gravity="fill"
android:layout_rowSpan="2"
android:text="@string/btneql" />
<Button android:text="@string/btnpow" />
<Button android:text="@string/btnper" />
<Button android:text="@string/btnmod" />
</GridLayout>
Eclipse在上面代码的第一行给了我错误。。。
错误为-“视图需要API级别14(当前最小值为8):”
请帮帮我。。!!
我已经下载了API版本14(安卓4.0),然后我也得到了这个错误 在清单中使用:
<uses-sdk minSdkVersion="14" />
但是,这意味着任何运行低于14的android API的设备将无法使用您的应用程序。在AndroidManifest.xml中设置android:minSdkVersion=“14”
<uses-sdk android:minSdkVersion="14"/>
如果您想使用API版本低于14的GridLayout和目标设备,还可以尝试Android支持库中的后端口GridLayout库。有关详细信息,请参阅此问题的答案:现在您可以使用提供与API Level 7+兼容的GridLayout 这样,您只需在XML上使用
android.support.v7.widget.GridLayout
,就可以获得具有本机行为的向后兼容的GridLayout
见:
- 交换机需要API 14,对于旧版本,请使用SwithCompat:
<android.support.v7.widget.SwitchCompat
android:id="@+id/switch_compat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:checked="true"
android:textOff="OFF"
android:textOn="ON"
app:showText="false"
android:focusable="false"
witchCompat switchCompat = (SwitchCompat)convertView.findViewById(R.id.switch_compat);
switchCompat.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
textView.setText("check");
} else {
textView.setText("unCheck");
}
}
});
Gr8建议。。!!但是我应该怎么做才能在最大API版本上运行它。。。我的意思是-在下面的API 14版本中..要么根据Android源代码中给出的格式编写自己的GridLayout,要么使用现有的布局选项尝试创建一个类似GridLayout的布局。编写自己的GridLayout意味着什么?