首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法在Ruboto中创建片段UI

无法在Ruboto中创建片段UI
EN

Stack Overflow用户
提问于 2013-09-29 18:49:00
回答 1查看 149关注 0票数 0

我正努力用Ruboto实现一个片段UI。我有一个非常好的工作活动,在它的onCreate方法中创建它的视图,这就是我试图移植到一个片段中的内容。

最后我得到了这样的结果:

在activity ()方法中,我只是为片段视图构建了一个占位符;

代码语言:javascript
复制
#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也不起作用。

代码语言:javascript
复制
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吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 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来尝试新特性。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19081910

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档