Hey i have TextInputLayout in my fragment. I am op...
# android
v
Hey i have TextInputLayout in my fragment. I am opening Popup window on clicking on TextInputEditText. I achieved that in synthetic way, but i want to use in view binding. Can you please suggest me how to do in proper way without using include layout options. fragment.xml
Copy code
.....
    <com.google.android.material.textfield.TextInputLayout
                    android:id="@+id/container"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10dp"
                    android:hint="@string/hint"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toBottomOf="@+id/header">
    
                    <com.google.android.material.textfield.TextInputEditText
                        android:id="@+id/input"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:focusable="false"
                        android:focusableInTouchMode="false"
                        android:inputType="textCapWords|textNoSuggestions" />
    
                </com.google.android.material.textfield.TextInputLayout>
Fragment.kt
Copy code
class CountryFragment : Fragment() {

   
    private var popupViewArea: View? = null
    private var _binding: FragmentBinding? = null
    private val binding get() = _binding!!
 
    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
        _binding = FragmentBinding.inflate(inflater, container, false)
        setupView()
        return binding.root
    }

     private fun setupView() {
        binding.input.setOnClickListener {
            showCountriesList()
         }
     }

     private fun showCountriesList() {
        if (popupViewArea == null) {
            popupViewArea = layoutInflater.inflate(R.layout.pop_list, null)
            popupViewArea?.popup_list?.layoutManager =
                LinearLayoutManager(context, RecyclerView.VERTICAL, false)
        }
        
    }

    override fun onDestroyView() {
        super.onDestroyView()
        _binding = null
    }

}
I want to convert pop_list to view binding. But i can't find a proper way without include tag pop_list.xml
Copy code
<LinearLayout xmlns:android="<http://schemas.android.com/apk/res/android>"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:orientation="vertical"
              android:layout_marginTop="4dp">

    <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/popup_list"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingStart="10dp"
            android:paddingTop="20dp"
            android:paddingEnd="30dp"
            android:scrollbars="vertical" />
</LinearLayout>
😶 3