【问题标题】:Grid Layout Width Issue网格布局宽度问题
【发布时间】:2014-02-04 22:27:38
【问题描述】:

我一直在开发一个应用程序,我还需要处理它的 UI 内容。

这是我的 XML:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
  <GridLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:columnCount="2" >
    <ImageView />
    <TextView />
    .
    .
  </GridLayout>
</ScrollView>

现在问题是右列的宽度。它超出了设备的宽度。例如具有android:layout_gravity 属性设置为中心的手机名称。但正如您在下面的屏幕截图中看到的那样,它没有按预期工作:

由于文本是动态的,我应该使用什么来限制宽度。

【问题讨论】:

    标签: android user-interface grid-layout


    【解决方案1】:

    我在使用带有fill_horizontal 的GridLayout 时遇到了类似的问题。我的解决方案是设置android:layout_width="0dp",因此您可能想对第二列中的所有视图进行尝试。

    Source

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-04-28
      • 1970-01-01
      • 1970-01-01
      • 2011-01-05
      • 2019-10-11
      • 2013-02-06
      • 2018-11-24
      • 1970-01-01
      相关资源
      最近更新 更多