Let's move to the code to bring some life to out component. Here's an example: item_code_edit_text.xml The class Just remember to use the right id in order to correctly retrieve it later via code. It can be copied to the destination project’s res/layout folder and changed as desired. I'll leave this to the reader: this is a fully customizable part of the library. The item's layoutīy "item" I mean a single character inside the custom view: a TextView where every Char of the code will be displayed. Insite this last one we'll inject the elements of our custom view. Morover, on top of it there's a way bigger hsvCodeWrapperScroller that we will use to horizontally scroll our LinearLayout. You read it good: we need an EditText but just its behaviour, not its shape! □♂️Īs you can see, editCodeReal is well "hidden" with its 1dp width, 1dp height and 0sp textSize. What if we don't? What if the best way to customize an EditText is… HIDE IT? The main idea might be to grab the EditText class, extend it and play around with it. The new Composable is available here: Making the custom EditText The view's layout The fundamental idea behind CodeEditText has been re-worked and released for Compose as the NEW CodeTextField! It is powerfull and it will soon be the preferred way do develop our favourite apps. What makes it so special? Go directly at the end of the article to find the link and have a look □ Than, just add it as a Gradle dependency and follow the README or checkout the sample project to start using it! □Īnyway, if you’re interested in how I made it, WITHOUT any extra library and if you'd like some advice making your own one, well… keep reading □ Jetpack ComposeĬompose is the new Android’s toolkit for building native UI. I have already written this library and I highly recommend you to use it inside your project. Here's a CodeEditText Looking for the solution?
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |