Android: Create Form Layout - android

How do I create a layout similar to this one in Android:
I have tried using TableLayout but it didn't go as expected because the Rows take the width of the largest one.

You could try using horizontal linear layouts inside of a veritcal linear layout. Also, you could try creating a custom listitem and using a listview to create the rows you desire

Related

how can I make this type of layout dynamically using Linear Layout?

Can anyone just tell me the structure of XML file? and I don't want to use Table and how can I repeat that layout using for loop.
You should use linear-layout which orientation is horizontal.
Other way, you can use Relative layout.
For separation use Horizontal and Vertical Divider.

Android Horizontal oriented LinearLayout - how to know how many TextViews will fit?

My Idea is adding TextViews with rounded corners background to a horizontal LinearLayout, so if next one wouldn't fit - I will add TextView to another LinearLayout below.
Is there a way to do so? I know it sound like a custom view, but I would like not to bother as much - to adjust height, make click area calculations istead of simple clickListeners
Sounds like a recyclerview using a flexbox layout https://github.com/google/flexbox-layout with flexWrap turned on.
You could also use is in a static layout as well.
With flexWrap it does all the calculations to see if the "item" can fit on a line and if not starts a new line.
Many examples on the github page.
You could keep adding text views in linear layout while checking if newly added text view is outside of linear layout horizontal boundaries, if it is you could remove it from linear layout and add it in new one but I see no reason why you would want to do that.

How to create linear layout with different orientation within textviews programatically?

How can I create linear layout with different orientation within textviews programatically?
I want to create linear layouts
The first linearlayout with horizontal orientation as parent, then inside first parent layout I want to create 7 linearlayouts and textviews and the 7 created textviews should be below the 7 linearlayots....
Expected result:
The notion of layouts "within" TextViews doesn't exist, it can't be done. We put TextViews in layouts instead.
I'd suggest one big horizontal LinearLayout, in which you add the number of vertical LinearLayout that you need. Each of these vertical layouts containing two textViews, one for the big letter and one for the small word.
You should define part of it in the XML though. The inner layout (the vertical one) could be in an XML file with it's two TextViews. Then for each letter you load the XML using the LayoutInflater and just set the two textView's values.

How to create multilevel listview/recyclerview with navigation

I am new to android development. I got the design from client as show in the image bellow. can anyone suggest me how to create view like this?. I have created the expandable recycler view but not getting how to create multilevel listview.
You can use for each entry (list item) , a framelayout since it allows overlapping easily , have an image view inside it to take all the available space , and a Relative layout to define the other elements like the number, the color below it, etc... and then wrap this Relative layout with a Linear Layout ; the Relative layout would be first element , and then the Recycler/List View would be the second element below the relative , at first it is visibility="gone" , and on relative layout clicked ... relative.setVisibilty(View.VISIBLE) and so on ...
What you want is a bit more complex than what i said , but either way this is a good headstart !

Dynamically adding views To Horizontal LinearLayout goes out of the screen

I have to create Text Views and Edit Texts dynamically and insert it inside the linear layout(horizontal) which is already declared in the XML file. Number of Text Views and Edit Texts to be inserted varies dynamically. I am creating the views dynamically and adding it to the linear layout.But the problem is that if number of views is more it moves out of the screen in spite of coming in the next line.what should I do to make the views come in next line if no space is available.
There is currently no Android layout with that behaviour.
Nevertheless, it has already been tackled in other threads (such as Android - LinearLayout Horizontal with wrapping children), which provide guidance on how to implement such a layout.
You can't do it with linearlayout, try tablelayout!
Use ScrollView and add your LinearLayout into ScrollView.

Categories

Resources