How to Make a Tic Tac Toe Game in Android – Part 1 – THE LAYOUT – Android Studio Tutorial


In this video series we will create an offline 2 player Tic Tac Toe game. We will code the whole game logic, count player points, add a reset functionality and handle orientation changes, so we don’t lose our game state when we rotate the device.

In part 1 we will create the layout by creating 9 buttons within nested LinearLayouts and we will even them out over the screen by adding the layout_weight attribute. Our player points and reset button will be in a RelativeLayout.

Watch the whole playlist:

Source code:

❗ Subscribe to the channel:

⏯ Watch more tutorials:

㊙ Help translating the videos:

💚 Support the content:

💬 Join the Discord chat:

🎧 Audiobooks and podcasts for programmers:

👶 How to get started with Android development:

📣 Follow Coding in Flow on social media:






Xem thêm bài viết khác:

33 thoughts on “How to Make a Tic Tac Toe Game in Android – Part 1 – THE LAYOUT – Android Studio Tutorial

  1. i have made the game and even done some changes in the ui

    but i want to know can u add the online feature to the game??

  2. Anyone having problems manually making the constraint layout to a linear layout, just use the design view and right-click the ConstraintLayout, click 'convert view', and select Linear Layout. Not sure why but manually editing it was impossible for me lol

  3. Thank you Coding In Flow.
    I just created and modified the app with google ads. If someone need source code of this app with google ads then message me. I also changed some designs. Check it from apk link:-

  4. Zooming the video

    Is this plugin in android studio or
    Just for video editing

    If this is a plugin then please let me know
    Which plugin is that?

  5. How about Board games like chess? It is Advisable to use buttons as tiles of it? If not, what will you suggest?

  6. I can't drag button just simple like that. I have to use those circle icons, but it moves a button only in horizontal orientation.

  7. Hi Coding in Flow, I love your tutorials. I was just wondering why the last move X or O is not displayed on the button? I tried to delay the check winner logic with Thread.sleep but even with one second delay the last move is not displayed on the button. Any idea why that happens?

  8. your video in show tools:context="com.codinginflow.tictactoe.MainActivity"

    but my new letest version of android studio show only tools:context="MainActivity" i tyr many times but cannot fix problem

  9. Bro can you send me this project final report. I have to submit. this is my gmail id.

  10. Thank you so much for this tuts. Is there a way where you could add a player vs. computer? Do you have the code with this? Thank you 🙂

  11. So i have that little issue, I can't drag buttons.. code is exactly like yours, i tried to look for something on the internet but found nothing except for things that didn't help, can you please land me a hand..? Great video, tho 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *