Weather app #7 – ViewPager, TabLayout
MainFragment import android.Manifestimport android.os.Bundleimport androidx.fragment.app.Fragmentimport android.view.LayoutInflaterimport android.view.Viewimport android.view.ViewGroupimport android.widget.Toastimport androidx.activity.result.ActivityResultLauncherimport androidx.activity.result.contract.ActivityResultContractsimport androidx.fragment.app.FragmentActivityimport com.google.android.material.tabs.TabLayoutMediatorimport com.meter_alc_rgb.weatherappcursey.Rimport com.meter_alc_rgb.weatherappcursey.adapters.VpAdapterimport com.meter_alc_rgb.weatherappcursey.databinding.FragmentMainBindingclass MainFragment : Fragment() { private val fList = listOf( HoursFragment.newInstance(), DaysFragment.newInstance() ) private val tList = listOf( “Hours”, “Days” ) private lateinit var pLauncher: ActivityResultLauncher<String> private lateinit var binding: FragmentMainBinding override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? ): View { binding = FragmentMainBinding.inflate(inflater, container, false) return binding.root } override fun onViewCreated(view: View,… Подробнее »Weather app #7 – ViewPager, TabLayout