3
我试图运行采用了android的FragmentLayout示例程序:异常马上蝙蝠
坠毁马上投注做的setContentView()的minSdkVersion =“15”,获得例外低于:
Unable to start activity ComponentInfo{net.examples.HelloFragmentLayout/net.examples.HelloFragmentLayout.FragmentLayout}: android.view.InflateException: Binary XML file line #6: Error inflating class Fragment
“net.examples.HelloFragmentLayout/net.examples.HelloFragmentLayout.FragmentLayout
”看起来像重复,但我不知道是什么造成了这种情况。
在我的fragment_layout.xml
(下面)中,我收到一条警告:“此FrameLayout
可以替换为合并标签”。不知道这是否有影响。
<?xml version="1.0" encoding="UTF-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Fragment class="net.examples.HelloFragmentLayout.TitlesFragment"
android:id="@+id/titles"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>
非常感谢杰克。 我越来越: net.examples.HelloFragmentLayout.TitlesFragment不能转换到android.support.v4.app.Fragment ...当我fragment_layout.xml有这样的: <片段类=“net.examples.HelloFragmentLayout.TitlesFragment” ... – user1174708 2012-01-28 23:42:26
听起来像你是从'android.app.Fragment'而不是'android.support.v4.app.Fragment'继承。 – 2012-01-29 05:52:42