Reputation: 110
I've created a basic android tv project in android studio , I got the default project with the Leanback library, this is my first time working on an android Tv project , I have experience and i've worked before on basic mobile projects , so I already have a good backround about other types of layouts ( in mobile dev ).
I noticied that the android Tv has the same project architecture but the difference is in layouts and input ( considering that we use remote controller in android Tv ) .
I am trying to create a simple app that have a sign up layout that looks like this
I know that changes needed to be done to the inputs and the button ... ( to match tv perspectice ) , but for now , I wanted to know if it's possible to customize and create such a layout.
I've searched everywhere and I saw that leanback is limited , is there any start point where I can begin with or a sample projects that has similar features.
Upvotes: 0
Views: 515
Reputation: 9439
The short answer is that yes, this is possible, but it isn't great for users due to how difficult typing in this much info is on a dpad. Most apps provide a means of signing up on the web (so the user can use a computer with a keyboard) or mobile (for the better virtual keyboard) because many users will bail out of a big signup flow on TV. I'd highly recommend going that route. If that can't work for your use case, then there are a few options.
The Leanback library is really just meant to simplify creating apps rather than cover every possible case. The closest it has to something like this is the GuidedStepSupportFragment. It allows you to get user input across one or more screens. This works well for a few fields but doesn't extend well to having ~10 like the sample screenshot. If you can simplify the initial signup to a few of these fields, that might be an option.
If you really need all of these, consider splitting them up across a few screens. In that case, you can create your own layout however you want just like for Android mobile. The main thing you need to consider is overscan, but that's mostly a matter of making sure you have enough margin/padding around the important elements. You can use the same kinds of views as Android mobile such as TextView for the labels and an EditText for the text entry fields, but you'll want to make sure text is much larger than mobile. android:textAppearance="?android:attr/textAppearanceMedium"
is a good starting place. You need to make sure that anything focusable has a visual indication when it's in focus (such as a StateList). All of the standard form controls like EditText or Button are focusable by default, but you'll need to explicitly mark any custom views as focusable if needed.
Upvotes: 1