我正努力用Ruboto实现一个片段UI。我有一个非常好的工作活动,在它的onCreate方法中创建它的视图,这就是我试图移植到一个片段中的内容。
最后我得到了这样的结果:
在activity ()方法中,我只是为片段视图构建了一个占位符;
#initial UI
setContentView(
frame_layout( :id => 100) do
text_view :text => "fragment place"
end
)
#fragment creation
ft = getFragmentManager().beginTransaction()
frag = MyFragment.new
ft.add( 100, frag )
ft.commit()在片段onCreateView方法中,即使返回这样的简单UI也不起作用。
def onCreateView( inflater, container, savedInstanceState)
ruboto_import_widgets :TextView,
frag_view =
linear_layout(:orientation => :vertical) do
text_view :text => "fragment view"
end
return frag_view
end但是片段UI没有显示,只显示原始UI ( logcat中也没有错误),有什么问题吗?
有人成功地用ruboto创建了片段UI吗?
发布于 2013-10-05 22:53:37
我刚刚在这里添加了一个使用Ruboto片段的新教程:
https://github.com/ruboto/ruboto/wiki/Tutorial:-fragments
工作示例以编程方式添加片段。我们也想展示如何使用XML布局来完成这个任务,但是它应该回答您的问题。如果您有任何意见,我们将在这里跟踪这个问题:
https://github.com/ruboto/ruboto/issues/492
已更新
对在片段中使用" Ruboto /widget“的支持刚刚添加到Ruboto master中,并将于本月在Ruboto 0.16.0中发布。我们增加了一个新的教程,演示了这种用法:
https://github.com/ruboto/ruboto/wiki/Tutorial:-dialogfragment
您现在可以通过从源代码构建Ruboto来尝试新特性。
https://stackoverflow.com/questions/19081910
复制相似问题