androidbroadcast / ViewBindingPropertyDelegate

Make work with Android View Binding simpler
https://proandroiddev.com/make-android-view-binding-great-with-kotlin-b71dd9c87719
Apache License 2.0
1.42k stars 102 forks source link

Not inflating correctly when using CreateMethod.INFLATE #47

Closed szaske closed 3 years ago

szaske commented 3 years ago

When I attempt to use your library on my Fragments it does not inflate correctly. The layout is squished in the top left corner of my screen. My standard code looks like this:

private var binding: FragmentTestBinding? = null

    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        binding = FragmentTestBinding.inflate(inflater, container, false)
        return binding?.root
    }

but it looks like your code, in the INFLATE enum, is making the container null. My guess is that this is what's causing the issue. Anyway my company currently extends the Fragment class so I'm not able to pass in the XML file into the Fragment as you seem to like doing in your examples.

nzeeei commented 3 years ago

I have the same problem because of passing null as root :(

kirich1409 commented 3 years ago

How it connected with the library? You use ViewBinding without the library.