我正尝试在我的 Android 应用程序中使用 GridLayout,我希望它从屏幕左侧开始 160dp。当我设置 android:layout_marginLeft="160dp"
时,我在 Eclipse 的 GraphicalLayout 选项卡中看到了这种情况,但是当我构建应用程序时,它并没有反射(reflect)出该边距。
我错过了什么吗?
我的其余 GridLayout 代码:
<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/GridLayout3"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="160dp"
android:columnCount="4"
android:orientation="horizontal" >
最佳答案
你在使用 http://developer.android.com/reference/android/view/LayoutInflater.html#inflate(int , android.view.ViewGroup)
膨胀布局?如果是这样,您是否提供了 Root View ?如果您传入 null,所有 layout_
属性将从您的 GridLayout 中删除。
关于android - marginLeft 似乎不适用于我的 GridLayout,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14652959/