Issue
Recently I came across the use-case of using tools:context
in my layout files for activities.
I learned that I can use it to associate an Activity class file to my layout file.
But how can I use it to associate a Fragment class file to any layout?
Bacuase as I have tried, it is only showing Activity list in autocomplete suggestion.
Solution
Have you tried it doing like this:
Let's say Relative layout
is your parent layout in your fragment's
layout:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Folder.Fragment" >
Now this .xml file will be associated with your .Fragment class
which is a fragment.
Answered By - Umair
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.