I am creating fragment in android Xamarin.
This is what I have done so far:-
PortfolioFragment.cs
class PortfolioFragment: Fragment
{
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
base.OnCreateView(inflater, container, savedInstanceState);
var view = inflater.Inflate(Resource.Layout.portfolio_fragment, container, false);
return view;
}
}
fragment.axml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:minWidth="25px"
android:minHeight="25px">
<TextView
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/textView1" />
</LinearLayout>
Main.cs
PortfolioFragment pFragment = new PortfolioFragment();
FragmentTransaction fragmentTx = this.FragmentManager.BeginTransaction().Replace(Resource.Id.fragment_container, pFragment);
But I receive an error:
Error 1 'MyProject.Resource.Id' does not contain a definition for 'fragment_container'
What can be wrong?
0 comments:
Post a Comment