【问题标题】:Edit children in scrollview where scrollview is a child of relativelayout in android studio在滚动视图中编辑子项,其中滚动视图是 android studio 中 relativelayout 的子项
【发布时间】:2015-12-12 14:51:36
【问题描述】:

在我的 xml 层次结构中,我将根元素作为 RelativeLayout,然后将 Scrollview 作为子元素。然后ScrollView 有一个RelativeLayout,里面有视图。

我的问题是我无法编辑ScrollView 中的内容,因为Android Studio 的设计视图没有显示整个ScrollView。我试过切换视口渲染模式按钮,但这并没有改变任何东西(注意:我的ScrollView's fillviewport 也是如此。

有没有办法让我在我的ScrollView 中查看所有内容,其中ScrollView 是Android Studio 设计视图中RelativeLayout 的子项?

【问题讨论】:

    标签: android xml android-studio scrollview android-scrollview


    【解决方案1】:

    我也有这个问题。

    如果您有类似...的视图层次结构

    RelativeLayout (root)  
      --> ScrollView
        --> RelativeLayout
          --> Views (e.g. Buttons, TextViews, etc.)
    

    ...我将上面的布局更改为...

    RelativeLayout (root)
      --> Include
    

    ...我的 include 标记引用另一个 XML 布局...

    ScrollView
      --> RelativeLayout
        --> Views (e.g. Buttons, TextViews, etc.)
    

    在 Android Studio 的预览版中,第一个带有 <include> 标签的 XML 布局应该在设备上显示(部分完整)布局。

    第二个 XML 布局,以 ScrollView 作为其根应该显示所有 Views。

    据我所知,不幸的是,没有其他方法可以解决这个问题 - 如果有替代解决方案,我很乐意看到。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-09-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-17
      相关资源
      最近更新 更多