获取片段的Anko布局预览
有没有可能在Android Studio中预览Anko布局的片段?我已经尝试过使用AnkoComponent的方式,但我无法让它为一个片段工作。我有以下代码(精简为基本代码): 但是如何在片段中使用AnkoComponent呢 多谢各位获取片段的Anko布局预览,anko,Anko,有没有可能在Android Studio中预览Anko布局的片段?我已经尝试过使用AnkoComponent的方式,但我无法让它为一个片段工作。我有以下代码(精简为基本代码): 但是如何在片段中使用AnkoComponent呢 多谢各位 瑟伦 class ProjectsFragment : Fragment() { override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstance
瑟伦
class ProjectsFragment : Fragment() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
}
class FragmentUI : AnkoComponent {
private var projectsAdapter: ProjectsAdapter = ProjectsAdapter()
override fun createView(ui: AnkoContext) = with(ui) {
verticalLayout {
recyclerView {
lparams(width = matchParent, height = matchParent)
layoutManager = LinearLayoutManager(ctx)
adapter = projectsAdapter
}
}
}
}
}