android-3.0-honeycomb

android searchview setOnActionExpandListener on Honeycomb 3.2

泄露秘密 提交于 2019-11-27 16:07:55
问题 I'm developing an app for Android 3.2 and greater with android-support-v4 . I need to implement OnActionExpandListener for "intercept" when SearchView in the actionbar is expanded and when is collapsed. My code for Android 4.0 and higher it's ok, but for 3.2 no. menu.xml <item android:id="@+id/menu_search" android:title="@string/menu_search" android:icon="@android:drawable/ic_menu_search" android:showAsAction="collapseActionView|always" android:actionViewClass="android.widget.SearchView" />

How to add app's shortcut to the home screen

元气小坏坏 提交于 2019-11-27 14:59:47
I know it's not documented and won't work on every device, but I see more and more apps placing their shortcuts on the home screen after they got installed. Found bunch of code chunks how to do it but for me they don't fit together. This is what I got for now. Need a permission in the manifest. <uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" /> Create an Intent of activity that should be called. Ex (from cgeek): Intent shortcutIntent = new Intent(); shortcutIntent.setClassName("com.example.androidapp", "SampleIntent"); shortcutIntent.addFlags(Intent.FLAG

Fragment without a view crashes on configuration change

旧城冷巷雨未停 提交于 2019-11-27 14:43:02
问题 I have an UI where I need a Fragment to be displayed (with a view) in landscape mode but not in portrait mode. In portrait mode it should still be available but will display its result using ListPopupWindow instead. I figured I could handle this by using the <fragment /> tag for the landscape layout while creating the fragment programmatically if it wasn't started (in the case when we are in portrait). This works fine as long as you start out in landscape, if you start in portrait where the

Orientation change in Honeycomb

浪尽此生 提交于 2019-11-27 14:38:43
问题 I have an activity that shouldn't be recreated after an orientation change. I added the following to the activity declaration in the manifest: android:configChanges="orientation" On Android 2.3 this works perfectly. On HONEYCOMB_MR2 onCreate is called anyway when change the orientation. Is there something else that needs to be done on HONEYCOMB_MR2 to prevent recreating the activity after an orientation change? 回答1: Apparently using orientation|screenSize (?) prevents onCreate on Honeycomb

Custom preference, targetSdkVersion=“11”: missing indent?

∥☆過路亽.° 提交于 2019-11-27 13:45:36
问题 I have a couple of custom DialogPreference implementations floating around, such as this one: package apt.tutorial; import android.content.Context; import android.content.res.TypedArray; import android.os.Bundle; import android.os.Parcel; import android.os.Parcelable; import android.preference.DialogPreference; import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; import android.view.ViewParent; import android.widget.TimePicker; public class TimePreference

Android 3.0 ActionBar, changing colors

为君一笑 提交于 2019-11-27 13:11:37
问题 How can I change the color of the underline beneath the tabs? It's currently the light blue, and I can't find any resources on how to change this for Android 3.0. Additionally, I'd like to change the text color for the menu items that show up on the right of the ActionBar as a result of: android:showAsAction="ifRoom|withText" Anyone know how to change these? 回答1: You can control the appearance of the tabs by using the properties android:actionBarTabStyle , android:actionBarTabBarStyle , and

ViewPager: Recursive entry to executePendingTransactions

最后都变了- 提交于 2019-11-27 13:01:14
I have a ViewPager within a ViewPager and I am getting this exception 09-07 18:30:26.392: ERROR/AndroidRuntime(841): FATAL EXCEPTION: main java.lang.IllegalStateException: Recursive entry to executePendingTransactions at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1331) at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:422) at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:86) at android.support.v4.view.ViewPager.populate(ViewPager.java:453) at android.support.v4.view

Retain Fragment state between Activities

六眼飞鱼酱① 提交于 2019-11-27 12:52:47
Its possible to retain a Fragment between Activities? Lets say I have Activity A with Fragment F_Left placed at the left and Fragment F_Right placed at the right. If I want to launch a new Activity and keep Fragment F_Left ... how can I do it? Can I retain Fragment F_Left state between activities? Note that I want to launch a new Activity because Fragment F_Left is my app menu and Fragment F_Right changes completely the context of the user operations... and my app have many of operations, so it makes sense to have an Activity per operation. I know its possible to retain Fragment within an

How to set a Fragment tag by code?

限于喜欢 提交于 2019-11-27 11:30:48
I haven't found something like setTag(String tagName) method in the Fragment class. The only way to set a Fragment tag that I have found is by doing a FragmentTransaction and passing a tag name as parameter. Is this the only way to explicitly set a Fragment tag by code? Yes. So the only way is at transaction time, e.g. using add , replace , or as part of the layout. I determined this through an examination of the compatibility sources as I briefly looked for similar at some point in the past. You can set tag to fragment in this way: Fragment fragmentA = new FragmentA(); getFragmentManager()

Styling EditText view with shape drawable to look similar to new holographic theme for Android < 3.0

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-27 11:15:34
I want to create a shape drawable for that mimics the new holographic theme (Android >=3.0) on older Android versions. It's quite easy to draw a line at the bottom with <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape > <solid android:color="@color/border" /> </shape> </item> <!-- main color --> <item android:bottom="1.5dp"> <shape > <solid android:color="@color/background" /> </shape> </item> </layer-list> But how to draw the tick boundaries left and right as in the holo theme Entreco It's a little hack, but unless