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.
Related
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
I am fairly new to android studio and I am trying to make a car rental app for a university project.
I designed an app which has a horizontal slider containing blocks of different cars however I am unsure on how I would do this, I understand how the slider works and how to add elements to it.
I have a linear layout within the horizontal slider which will contain all of the blocks but I am unsure how to make a block of elements. Within the block it should have two buttons, an image and some text. Here is a picture of the design.
As you can see the available blocks are surrounded by a square. this is what I want, a small container which surrounds my data. Sort of like a div box in html.
Is there a way to do this?
Please just point me in the correct direction!
Many thanks!
It seems like cardviews can handle most of the grouping you want to do. I would reccomend looking into them because they incorporate a lot of material design components right out of the box.
https://developer.android.com/guide/topics/ui/layout/cardview
I have say 3 images in a view and want to display a list upon selecting any of the images. Upon selecting an image a list shows up adjacent to the image that was selected. Only one list can show at a time, so if a list is visible next to one image and another image is selected a new list is built next to the selected image and the existing list disappears.
The lists are built using arrays.
Should I use listview or listactivity. Or might there be a better approach to doing this.
Thanks,
you can use Recyclerview List for your mentioned problem
The easiest way, according to me, is to make the layout as you want with the images and with listviews and put initially visibility gone on the lists. When a image is clicked make that list visible (setVisibility(View.VISIBLE)) and the other ones gone (setVisibility(View.GONE)).
This is the most straightforward solution.
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 be able to add a text-messaging balloon every time the user revives data from a HttpGet, I want it so that it looks nearly identical to the default Android text messaging UI. I'm fine with all the code, I just need a way to create the UI and create another text balloon every time data comes back from a HttpGet request.
Thanks ever so much, for the answering this questions and I'm sure there's an easy way to do it, yet I've found no way by using the 'ole Google.
I am doing something similar for my app am doing the following to achieve it:
You will need a 9-Patch-Image (a stretchable PNG, see here) that represents the bubble. You want to make the part stretchable that does not include the corners of the bubble. You can create the bubbles using an image editor of your choice (I'd recommend a vector graphics editor like Inkscape). Then use the 9-Patch editor included in the Android Developer Tools to transform the PNG image into a 9-Patch PNG.
Create a custom layout file for one bubble. Create a textview inside it, and add your bubble as a background resource. (android:background)
Use an arraylist with a custom adapter to inflate and fill your items.
So far, this will give you identical bubbles as background for all messages.
If you want to get fancy, you can create different bubbles for participants, and use the setBackgroundResource method in your Adapter to set the correct background.
Further, if you wish to align them left or right, like in the message app, you will need to add spacers to the left and right of your TextView in the layout file. I used FrameLayouts with a fixed width. Make sure to set their visibility to GONE.
As with swapping the different bubble colors, just set the visibility of the left/right spacer.