Two-dimensional lists - Selamat datang di situs media global terbaru Xivanki, Pada halaman ini kami menyajikan informasi tentang Two-dimensional lists !! Semoga tulisan dengan kategori
list !!
styles !!
tablelayout !! ini bermanfaat bagi anda. Silahkan sebarluaskan postingan Two-dimensional lists ini ke social media anda, Semoga rezeki berlimpah ikut dimudahkan Allah bagi anda, Lebih jelas infonya lansung dibawah -->
I got another question whether TableLayout can be used like a two-dimensional ListView. My initial reaction was that it cannot be done because TableLayout just arranges items, all the complicated focusing/highlighting logic in ListView is completely missing from TableLayout. I realized later on, however, that TableLayout can contain Buttons and the rest will be arranged by the general focus handling logic in ViewGroup.
Click here to download the example program.
The only exciting part of this rather simple program is the way how an array of Buttons are made to look like selectable list items. The key is that the Buttons are styled. For example (XML fragments are mangled due to blog engine limitations):
[Button android:id="@+id/button_1"
style="@style/MyButton"
android:text="1"/]
The referred style is in res/values/styles.xml. The funny part is this line:
[item name="android:background"]@android:drawable/list_selector_background[/item]
This line was copied straight from the system style of List.View and applies the ListView selector (that defines appearance of list elements in ListView in their different states) to the Button. No wonder the Button behaves like a list element.
Demikian info Two-dimensional lists, Semoga dengan adanya postingan ini, Anda sudah benar benar menemukan informasi yang memang sedang anda butuhkan saat ini. Bagikan informasi Two-dimensional lists ini untuk orang orang terdekat anda, Bagikan infonya melalui fasilitas layanan Share Facebook maupun Twitter yang tersedia di situs ini.