Невозможно перетащить ImageView в сетке в Android Studio 2.3.2
Это форма Android Studio 2.3+ Google изменил, как использовать сетку. Я пытался сделать игру Tic Tac Toe, и я сделал макет сетки 3X3, но я не могу вставить в него ImageView..!!
Это файл 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>
1 ответ
Я думаю, что сначала вы должны создать класс, а внутри основной деятельности сделать объект этого класса и поместить в вашу сетку.
класс Bdfd расширяет ImageView
MainActivity gridlayout gl Bdfd объект = новый Bdfd; gl.AddView(BDFD);
Если я понимаю твой вопрос. Должно быть что-то в этом роде..