![]() ![]() To reduce even more the loading time you could look into loading in a background thread while you show a smart animation or progress bar in the main thread. Lastly, If you absolutely must inflate programmatically, try doing it as one ConstraintLayout 9 times adding the 9 layouts within a parent ConstraintLayout and not a TableLayout (generally this is an outdated ViewGroup which has stopped being used because of its terrible loading time). You can create a single 9-box layout and include it multiple times through xml inside your parent layout and avoid inflating all the views at run-time. Inflating so many views almost at the same time is bound to freeze up your UI and make the user wait, which is definitely not desired. Instructions: You can either select a predefined set of six puzzles/grids from the top dropdown list or you can pick and choose individually using the dropdowns above each grid. If you are after animations, you could easily and beautifully do it with some Libraries both from the OS as third-party. Secondly, I want to ask if there's a reason for you to create the views dynamically. Logic puzzles come in all shapes and sizes, but the kind of puzzles we offer here are most commonly referred. You can even use included ConstraintLayout layouts as you are within your parent, although that is a bit unnecessary as all layouts are just translated back into one. What is a Logic Puzzle Example Logic Puzzle Grid. Try changing your TableLayout to a ConstraintLayout which is flat and has been proven to be generally a quicker solution. I have a few recommendations to give you.įirstly, you should try to use flat layouts when you are using a lot of view components. All I do is load this layout, there is no more code in my app at the moment.Īnyone has any idea how can I do what I want? I have seen lot of sudoku apps that have these 3x3 grid in each cell where you write pencil marks, but they must be implementing it in a different way. It seems that 810 text views is in fact too much work. TableLayout.LayoutParams paramsLayout = new TableLayout.LayoutParams(_CONTENT, _CONTENT) īut I still get the same situation. TableRow.LayoutParams paramsRow = new TableRow.LayoutParams(_CONTENT, _CONTENT) TableLayout sudokuGrid = (TableLayout) findViewById(R.id.sudokuGrid) SetContentView(R.layout.solver_principal) Īnd finally I have my activity where I programmatically inflate the cell layout 81 times into the table void onCreate(Bundle savedInstanceState) In here I want to insert the previous layout 81 times forming a 9x9 grid. I then have my principal layout (just a table layout). Download Now (.PDF) Sudoku Grid in Excel This download is a Microsoft Excel spreadsheet. It may not look like the PDF can be edited, but this one can. xml for completeness in case somebody wants to run it. After downloading this pdf, you can either quickly print a blank sudoku grid, or you can first enter the starting values. ![]() The important thing I need feedback on is just the last piece of code (the activity one). This consists of the possible pencil marks someone ussually uses. xml file that represents a single square in the grid. I am generating a 9x9 grid on which I will play sudoku later by setting click listeners to each square on the grid. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |