我得到吹氣錯誤在我的活動代碼
我提到這個網站,我不能得到解決
我的XML代碼:
二進制XML文件行#415:錯誤充氣類片段
<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="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<fragment
android:id="@+id/projectcommends_combine"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:name="com.servicebellpartner.Fragment.ProjectComments"
tools:layout="@layout/project_comments"></fragment></RelativeLayout>
我的活動代碼:
public class OrderDetails extends AppCompatActivity implements View.OnClickListener {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.order_detail);
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
ProjectComments projectComments = new ProjectComments(orderid);
fragmentTransaction.add(R.id.projectcommends_combine, projectComments);
fragmentTransaction.commit();
}}
我的代碼片段:
public class ProjectComments extends Fragment {
private String orderid;
public ProjectComments(String orderid){
this.orderid = orderid;
}
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.project_comments, container, false);
return view;
}}
我得到以下錯誤在運行應用程序
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.servicebellpartner/com.servicebellpartner.Activity.OrderDetails}: android.view.InflateException: Binary XML file line #415: Error inflating class fragment
請任何人給答案和解釋。
請......共享整個堆棧跟蹤... – W0rmH0le
什麼是堆棧跟蹤? – vinoth12594
@vinothkumar:從'android.support.v4.app.Fragment'使用片段? –