Tyler
Tyler

Reputation: 18177

Correct Android layout for this design

I am trying to build the following layout, but am unsure which android layout I should be using.

My layout

Its just a table (correct terminology?), but I would like functionality such as swipe to delete a row, and to expand on click (to reveal another view). It should also be scrollable.

What I have currently is a LinearLayout on a scroll view, which I populate with other custom layouts.

To achieve the expanding functionality, I have more custom views in the LinearLayout which are hidden by default, and then revealed if they layout above them is pressed. All of this lives in a ScrollView.


Would a TableLayout be better for all of this? I originally picked LinearLayout instead of TableLayout because I was confused about the TableLayout columns (and didn't need multiple columns). I feel like right now I am reinventing the wheel.

Upvotes: 1

Views: 202

Answers (1)

marshallino16
marshallino16

Reputation: 2671

You don't need ScrollView or TableLayout at all. The easy way is to use a ListView, then on the raw adapter, you implement an onTouchListener method with swipe gesture algorithme (not hard to code).

But the swipe and expandable view can be handle with this library (very usefull)

https://github.com/nhaarman/ListViewAnimations

Upvotes: 3

Related Questions