Inflating Custom View In Different Process (Xposed)
I'm developing an Xposed-module and would like to use a custom view class (the class is rather complex, so I can't recreate it from scratch/only using system UI elements). As per t
Solution 1:
Instantiating the class in code (with a context created from your app's package) works (while inflating it from xml does not).
The way to make this work:
- Add an empty <View>
placeholder in your xml (instead of the custom view itself)
- In your code, inflate the xml-layout
- Programmatically create an instance of your custom view class and add it as a child to the View placeholder:
ViewGroup mContainer = (ViewGroup) yourInflatedView.findViewById(R.id.container);
YourCustomViewClass mCustomView = new YourCustomViewClass(context);
mContainer.addView(mCustomView);
Post a Comment for "Inflating Custom View In Different Process (Xposed)"