Adaptative row in jetpack compose - android

I have this figma layout to do:
Image here
I already have the chips layout done.
Those chips shows a list of strings.
But I don't know how to get that adaptative row, that when the string are to big, the line break and keep showing in another line.
Can you guys help me please?

Accompanist library has flow layouts that do exactly that: https://github.com/google/accompanist/tree/main/flowlayout
There are also similar flow layouts in the official compose foundation library that were just recently merged, but those are only available as snapshot builds for now.

Related

Android MaterialDatePicker UI different from Material design Documentation

In my project I need to show a date picker that looks exactly like in the doc:
https://material.io/components/date-pickers#mobile-pickers
But what I see it's much different from it. I tried also the demo which I could download from the same link and it looks like mine, in fact I am attaching the Demo screen shots to compare the differences.
In particular in the demo there is a lot of margin on the sides, and also there is an horizontal line between the header and the scrolling part.
Demo:
Doc:
Is there any way to obtain the same results shown in the guideline page? If not why this difference? Where is that coming from?

Search for components in the layout designer palette of Android Studio

Is there any way to search for a component by name in the Android Studio layout designer palette?
Currently it is just a list of components grouped in some categories but there is even no sorting in the single groups.
I try to find the android.widget.SearchView component but fail to do so. I'm not sure whether I just miss it or it is not here.
It's under Containers.
Yes it does not make sense.
And the list is hardcoded here https://android.googlesource.com/platform/tools/adt/idea/+/master/android/src/com/intellij/android/designer/model/views-meta-model.xml
see the end of the document, and you will see the groupings. And yes this is very outdated, having fill_parent instead of match_parent everywhere.

How to make a User Interface of my android application

I am trying to make android application which display newsfeeds through web,I have done with all functionality, as I programmed well but not design well I am getting problem to desing UI of my Application,I donot have enough idea how to do this, whether I use relative layout,or linear layout etc, Would you suggest me the way how can I design UI in xml file, I would be very grateful to you
Use the UI Guidelines from Android Dev site. Take the trainings provided there if you require. Read the Quick Overview page as well to cover important aspects.
... and here is a resource listing page for further reference.
First you have to learn android layouts. Try with some examples on each layouts. People here can help you if you have any issue with layouts, but don't expect someone to design and code for you.
OK . I would suggest you to use these layouts for this screen
Use ActionbarActivity with menu items ( action icon)
Search view or Edit text
Image view
Text view
Vertical Linearlayout with Imageview and Text view
Grid view with text view items.

android table with more than one column like iOS collectionView

is there a custom UI element on android that will behave like iOS collection view?
[like a grid view, that is scrollable]
or do I have to make a custom table layout custom cells that behave like columns?
here a shot of a UICollectionView for iOS
is there an example for this?
thanks!
Since the previous answer does not reflect performance issues, such as it does not use recycling (which is important for long lists), here is what you are probably looking for:
GridView if your building blocks are all equal in size
http://developer.android.com/guide/topics/ui/layout/gridview.html
or ListView (and a lot of custom logic) if your building blocks have different sizes/widths
http://developer.android.com/guide/topics/ui/layout/listview.html
I don't know the collection view in iOS, but I guess TableLayout is what you are looking for.
https://developer.android.com/reference/android/widget/TableLayout.html
In API14+ there is GridLayout as well.
https://developer.android.com/reference/android/widget/GridLayout.html
Gridview is best replacement of Collection View of IOS. following URL will solve your problem.
http://developer.android.com/guide/topics/ui/layout/gridview.html
This is old, but the Google team have created a widget used in the IO 2014 app that's perfect. It allows for variable column rows and even headers out of the box.
https://github.com/google/iosched/blob/master/android/src/main/java/com/google/samples/apps/iosched/ui/widget/CollectionView.java
You'd have to dig through the source for how it's used, but it's really easy and great to use.
Nowadays RecyclerView is what you're looking for. GridView and others are considered legacy API now. RecyclerView is able to handle these type of layouts more efficiently.

iOS: How to achieve relative layout

I'm trying to make an iOS version of my Android app. It contains text that looks like this:
There are three labels: title, author, and publication year. I need to display the full title, which may be several lines long. However long the title is, I want the author label to be directly below the title, and the pub. year directly below that.
In Android, I just used relative layouts to achieve this effect. How can I do this in iOS? Can Auto Layout do this for me somehow? If not, do you have any suggestions for effectively displaying this information in iOS? Preferably I'd like to achieve this using the storyboard.
In iOS you use InterfaceBuilder IB for layouts - it's drag and drop - not like Android layouts.
Search for IB tutorials - it is really straight forward and you see what you get:-)
I also searched quite some time a way to achieve android-like layouts in iOS (without the hassle of computing every positions for each subviews).
I eventually gave up and coded a fast equivalent of VerticalLayout and HorizontalLayout. Here's the repo (it's ARC compliant) :
https://github.com/kirualex/iOS-Layout-helper
It's sketchy but it does the work !
Put simply relative layout organises items on the screen relative to something else. Like linear layout, relative layout is commonly used by android developers. I myself do like this layout and have used in the development of my applications before. See
http://developer.android.com/reference/android/widget/RelativeLayout.html and http://developer.android.com/guide/topics/ui/layout/relative.html for more information on relative layouts.

Categories

Resources