I've been trying to create a timetable and I have tried different layouts, the best i could get is to use a grid layout.
a preview of how it looks:
The header is a fixed view, I added that manually in the xml file.
but each of the "Off white" cells and cells that contains time are textviews added dynamically using a loop.
However I think it's not the most efficient way of creating this, also I wouldn't be able to locate those cells unless I add an id to each of them dynamically and store those Ids.
This example shows an empty time table. but those cells should be able to expand and merge with others when an event is added.
Is Grid Layout the only way to build this and is there more a more efficient way to locate each cell position?
this is similar to what I'm trying to achieve
Related
Im developing an Android app in Java using Android Studio. I have a layout called activity_way_bill, where it must show a list of trips. Also, I have a layout called item_waybill_trip, where I have labels for displaying the trips details.
I need to insert X item_waybill_trip layouts into the activity_way_bill layout (the X number I will know at runtime). Right now, I just have it included like this, in the XML file:
<include android:id="#+id/trip" layout="#layout/item_waybill_trip" />
But this is a static solution and only allows me to include 1 (or a predefined number) of layouts. I need to include X, and set different texts for each one. How can I do this?
If you want to display the list of element with the same layout but different data than you have to use recycle view.
You can also define the count at runtime and change the count if you needed.
You can visit the site below and check how to use recycle view. :-
https://developer.android.com/guide/topics/ui/layout/recyclerview
As mentioned in the answer by #Mahavir Jain you could use a recyclerview for that but if you want to go the other way, you will have to create the dynamic layouts at runtime and add them to the parent layout using the .addView() method of the parent layout
If your app needs to display a scrolling list of elements based on large data sets (or data that frequently changes), you should use RecyclerView as described on this page.
I have TreeViewTable like image below:
TreeViewTable
I want to set the second column to be hierarchical (with expander as well) instead of the first column. The first column is vertically aligned and the second column is tree-like displayed.
I have tried for hours but couldn't figure out how. What should be the best approach achieve that?
This is very easy in javafx. You just need to call method treeColumn(col) of TreeTableView
I want to create a grid or table of fixed number of rows and columns(Ex. 6x6 grid) in a layout of Android Studio. I tried using GridLayout and GridView but it requires you to put 36 EditText(Plain text) Views in it for creating a 6x6 grid. Same is the case with TableLayout where you can only insert TableRows but cannot fix the number of columns.
Bottom line is, I want a 6x6 grid which has only a 6-letter word(one character in each cell) in the beginning and one letter is typed in every turn to make a word with the existing letters.
For this, from any cell, I should be able to read the characters in the adjacent cells. I don't think creating a GridView or TableLayout and creating 36 objects of EditTextView will be the best idea. Is there a good and efficient way to do this? I need the .xml file code and also its Java class file's code.
Why you don't think that creating a layout holding views in Android framework is good and efficient way for exposing some data in a graphical interface? This is the only reason for which View class even exists. It's a main building material of your application's GUI.
Also you don't need to create it by hand. You just need to be able to address your ViewGroup (Layout) object from your Java code where you build your Activity instance. From there you have an addView() method and you can add views in a simple loop (notice that this way you can create grids of every size, not only 6x6).
Please familiarize yourself with official Android Developers site where you can read pretty much about anything relating Android Framework. For more info about layouts click here.
Try this library it might help you.
https://github.com/InQBarna/TableFixHeaders
I want to create a DayDream for my App and i want a Wall of images but i dont know how to randomize the images.
I want that some images are (2 times) bigger than other images and the other images are around them, all random. Is there a simple way to do this?
The Images are saved dynamically in a ArrayList of ImageViews before they will be loaded into the GridView.
Currently i have a simple Horizontal Layout which gets filled with ImageViews, but this is way too simple and won't fill the complete screen...
I have no point where i could start, any help would be fine!
I'm not sure that you can do that with a GridView. You're essentially looking to do a TableView and specify how many columns an item can take up. Alternatively, with some fiddling, you may be able to achieve what you want with a RelativeLayout.
For both TableView and RelativeLayout you'll have to write your own adapters to put the content in the views.
try http://www.androidviews.net/2013/01/quiltview-library/ or
http://www.androidviews.net/2013/01/pinterest-like-adapterview/
as far as i know quiltview is created randomly every time, so maybe u should go with that.
First of all, I'm using Swing in Java. In my application, I need to have a multi column list (if that's what I should call it). What I mean by a multi column list is something like windows explorer's list view mode of showing files and folders.
So, all of the columns of my list are going to have the same object (files for instance), but I want to be able to put them on different columns, in order to have a wider view.
Does anyone have any suggestion how I can do that?
Thanks,
Reza
One may use:
list.setLayoutOrientation(JList.HORIZONTAL_WRAP);
Alternatively you can use a JScrollPane. This will handle creating scroll bars and such for you, which would solve the issue of running out of vertical space, and thus eliminating the need for extra columns.