0

它是android studio 2.3+的形式嗎?google已更改如何使用網格佈局。我正在嘗試製作一個tic tac toe遊戲,並且我製作了3X3網格佈局,但是我無法將ImageView放入其中.. !!無法在android studio 2.3.2中的網格佈局中拖放ImageView 2.3.2

這是XML文件

<?xml version="1.0" encoding="utf-8"?> 
<android.support.constraint.ConstraintLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
tools:context="com.example.neerajm.tictacbasic.MainActivity"> 

<GridLayout 
    android:layout_width="match_parent" 
    android:layout_height="360dp" 
    android:layout_marginBottom="8dp" 
    android:background="@drawable/board" 
    android:columnCount="3" 
    android:rowCount="3" 
    app:layout_constraintBottom_toBottomOf="parent" 
    app:layout_constraintHorizontal_bias="0.0" 
    app:layout_constraintLeft_toLeftOf="parent" 
    app:layout_constraintRight_toRightOf="parent" 
    app:layout_constraintTop_toTopOf="parent" 
    app:layout_constraintVertical_bias="0.797" 
    android:layout_marginTop="8dp"> 

</GridLayout> 

</android.support.constraint.ConstraintLayout> 

回答

0

我覺得首先你要創建類和主要活動中做出的對象類,並把你的網格佈局

類Bdfd擴展的ImageView

MainActivity gridlayout gl Bdfd object = new Bdfd; gl.AddView(bdfd);

如果我理解你的問題,它必須是這樣的東西..