android.support.v7.widget.GridLayout内代码添加textview,v7包下的属性怎么用代码设置

<android.support.v7.widget.GridLayout

        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/commremind_tab"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingRight="10dp"
        app:columnCount="5"
        app:rowCount="5">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:text=""
            app:layout_columnWeight="3"
            app:layout_rowWeight="1" />
            

这两个属性怎么用代码设置
app:layout_columnWeight="3"
app:layout_rowWeight="1"

阅读 5.3k
1 个回答

((GridLayout.LayoutParams) this.getLayoutParams()).columnSpec =

GridLayout.spec(GridLayout.UNDEFINED, 3f);
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题