-2
我在我的活動中實施片段,有時會顯示以下錯誤。當我嘗試加載appActivity片段時。請幫我擺脫這種錯誤錯誤充氣課程片段
Java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.example.rff/com.example.rff.Parent}:
android.view.InflateException: Binary XML file line #68: Error inflating class fragment
我在這裏的XML文件的出
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="@+id/frag_parent"
>
<TableLayout
android:id="@+id/tablenew"
android:layout_width="match_parent"
android:layout_height="100dp"
android:background="#FFF"
android:paddingTop="1dp"
android:stretchColumns="0"
>
<TableRow
android:background="#000000"
android:paddingBottom="1dp"
android:paddingRight="1dp"
android:tag="new">
<TextView
android:id="@+id/newactivity"
android:text="@string/newact"
android:gravity="center"
android:layout_marginLeft="1dp"
android:textColor="#000000"
android:background="#FFF"
android:padding="10dp"
android:textSize="50sp"
/>
</TableRow>
</TableLayout>
</LinearLayout>
<LinearLayout
android:layout_width="1000dp"
android:layout_height="50dp">
<Button
android:id="@+id/app_new"
android:layout_width="420dp"
android:layout_height="match_parent"
android:text="Apps"/>
<Button
android:id="@+id/doc_new"
android:layout_width="400dp"
android:layout_height="match_parent"
android:text="Docs"/>
</LinearLayout>
<fragment
class="com.example.rff.AppActivity"
android:id="@+id/lm_fragment"
android:layout_width="0dp"
android:layout_height="wrap_content" />
<fragment
class="com.example.rff.DocActivity"
android:id="@+id/doc_fragment"
android:layout_width="0dp"
android:layout_height="wrap_content" />
</LinearLayout>
這裏是我的父母片段活動
FragmentManager fragmentManager = getFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
AppActivity appActivity = new AppActivity();
fragmentTransaction.replace(android.R.id.content, appActivity);
fragmentTransaction.commit();
AppActivity
public class AppActivity extends Fragment{
Context context;
ArrayList<ViewGroup> viewsList;
UpdateAppThread UpdateThread;
View view;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.app_new_layout,container, false);
context = view.getContext();
...
....
return view ;
}
嘗試計算器,你會看到很多類似的帖子 – Raghunandan
有你嘗試新鮮事物在這裏http://stackoverflow.com/questions/6424853/error提到搜索-inflating級的片段? – Pooja
或在這裏http://stackoverflow.com/questions/19874882/android-view-inflateexception-binary-xml-file-error-inflating-class-fragment? – Pooja