2013-01-10 186 views
3

我一直在开发一个应用程序,我也需要处理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的移动设备的名称。但它不工作像预期的那样,你可以在下面的截图中看到:

Device Screenshot

我应该怎么使用,以保持宽度与限制的文本是动态的。

回答

6

我有一个使用GridLayout与fill_horizontal类似的问题。对我来说,解决方案是设置android:layout_width="0dp",因此您可能想要在第二列中尝试所有视图。

Source