大佬教程收集整理的这篇文章主要介绍了android – ActionBar溢出菜单样式信息,用于手动实现,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
编辑
<style name="Widget.Holo.Spinner" parent="Widget.Spinner.DropDown"> <item name="android:BACkground">@android:drawable/spinner_BACkground_holo_dark</item> <item name="android:dropDownSELEctor">@android:drawable/list_SELEctor_holo_dark</item> <item name="android:popupBACkground">@android:drawable/menu_dropdown_panel_holo_dark</item> <item name="android:dropDownVerticalOffset">0dip</item> <item name="android:dropDownHorizontalOffset">0dip</item> <item name="android:dropDownWidth">wrap_content</item> <item name="android:popupPromptView">@android:layout/simple_dropdown_hint</item> <item name="android:gravity">left|center_vertical</item> </style>
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://scheR_580_11845@as.android.com/apk/res/android" android:id="@+id/dropdownContainer" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" > <LinearLayout android:id="@+id/leftBuffer" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" /> <LinearLayout android:layout_width="150dp" android:layout_height="match_parent" android:orientation="vertical" > <ListView android:id="@+id/actionbarDropdown" style="@style/Widget.ActionBarDropDown" android:layout_width="match_parent" android:layout_height="wrap_content" android:cachecolorHint="@android:color/transparent" android:entries="@array/sortOptions" /> <LinearLayout android:id="@+id/bottomBuffer" android:layout_width="match_parent" android:layout_height="match_parent" /> </LinearLayout> <LinearLayout android:id="@+id/rightBuffer" android:layout_width="118px" android:layout_height="match_parent" /> </LinearLayout>
将onClick添加到ActionBar项目中:将上述布局作为子项添加到您的Activities根ViewGroup中,可以获得下拉列表的错觉.
将onClick添加到从根ViewGroup中删除视图的每个缓冲区允许在尝试移动焦点时将下拉菜单“退出”.
下拉列表的样式信息是:
<item name="android:BACkground">@drawable/menu_dropdown_panel_holo_light</item> <item name="android:dropDownSELEctor">@drawable/list_SELEctor_BACkground</item>
每个列表项的布局是:
<?xml version="1.0" encoding="utf-8"?> <TextView xmlns:android="http://scheR_580_11845@as.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="48dp" android:textSize="17sp" android:gravity="right|center_vertical" style="?android:attr/dropDownItemStyle" android:ellipsize="marquee" android:id="@android:id/text1"> </TextView>
以上是大佬教程为你收集整理的android – ActionBar溢出菜单样式信息,用于手动实现全部内容,希望文章能够帮你解决android – ActionBar溢出菜单样式信息,用于手动实现所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。