package com.njsoft.jcyy.good.goodfragment
import android.os.Bundle
import android.support.v4.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.njsoft.jcyy.R
import com.njsoft.jcyy.shop.shopadapter.CommonTabPagerAdapter
import kotlinx.android.synthetic.main.fragment_blank.*
import java.util.*
/**
* A simple [Fragment]subclass.
*
*/
class GoodDetailFragment : Fragment(), CommonTabPagerAdapter.TabPagerListener {
override fun getFragment(position: Int): Fragment {
return GoodFragment()
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?): View? {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_blank, container,false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
//此处可以直接用ID
initViewPager()
}
private fun initViewPager() {
val adapter = CommonTabPagerAdapter(activity!!.getSupportFragmentManager(), Arrays.asList("商品介绍","规格参数","资质证明","包装售后"),activity)
adapter.setListener(this)
GoodViewPager.setAdapter(adapter)
GoodViewPager.setScroll(false)
GoodDetailTablayout.setupWithViewPager(GoodViewPager)
}
}
网友评论