网格布局宽度问题

Uma*_*ayr 3 user-interface android grid-layout

我一直在开发一个应用程序,我也需要处理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>
Run Code Online (Sandbox Code Playgroud)

现在问题是右列的宽度.它超出了设备的宽度.例如,具有android:layout_gravity设置为中心属性的移动设备的名称.但它没有按预期工作,你可以在下面的截图中看到:

设备截图

由于文本是动态的,我应该使用什么来保持宽度在限制范围内.

Alg*_*ues 5

我在使用GridLayout时遇到了类似的问题fill_horizontal.我的解决方案是设置android:layout_width="0dp"所以你可能想要在第二列的所有视图中尝试.

资源