在EditWorkDetails.java
(扩展到片段)中,它有两种不同的布局,即footer
和footer layout
。
错误
Error:(60, 47) error: cannot find symbol method getLayoutInflater()
EditWorkDetails.java
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View edit_details = inflater.inflate(R.layout.edit_work_details, container, false);
dbHelper = new MyDatabaseHelper(getActivity());
sqlcon = new WorkDetailsAPI(getContext());
listViewUpdate = (ListView) edit_details.findViewById(R.id.listViewEdit);
addClaims=(Button) edit_details.findViewById(R.id.buttonClaims);
footer = (AbsoluteLayout) edit_details.getLayoutInflater().inflate(R.layout.total_hours, null);
totalHours = (TextView) footer.findViewById(R.id.textView10);
footerLayout = (FrameLayout) edit_details.getLayoutInflater().inflate(R.layout.under_list_view_button, null);
btnSubmit = (Button) footerLayout.findViewById(R.id.btnSave);
btnAddClaims = (Button) footerLayout.findViewById(R.id.addClaims);
objMyCustomBaseAdapter = new MyCustomBaseAdapter(getActivity(), results, listViewUpdate, footerLayout, footer);
Bundle bundle = this.getArguments();
if(getArguments()!=null)
{
ID=bundle.getLong("ID");
}
Toast.makeText(getActivity(),ID+"",Toast.LENGTH_LONG).show();
BuildEditDetails(ID);
totalHours.xml
<?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:layout_width="175dp"
android:layout_height="33dp"
android:textColor="@color/indian_red"
android:textStyle="bold"
android:textSize="18sp"
android:id="@+id/textView10"
android:layout_x="174dp"
android:layout_y="16dp" />
</AbsoluteLayout>
under_list_view_button.xml
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<Button
android:layout_width="181dp"
android:layout_height="wrap_content"
android:id="@+id/addClaims"
android:layout_marginLeft="15px"
android:drawableRight="@mipmap/claims"
android:text="Add Claims"/>
<Button
android:layout_width="130dp"
android:layout_height="wrap_content"
android:id="@+id/btnSave"
android:drawableRight="@mipmap/submit"
android:layout_marginLeft="450px"
android:text="Submit" />
</FrameLayout>
我该如何解决这个问题?感谢
答案 0 :(得分:2)
尝试做
footerLayout = (FrameLayout) getActivity().getLayoutInflater().inflate(R.layout.under_list_view_button, null);