android-widget

can't change the textsize of the thumb of SwitchCompat widget

微笑、不失礼 提交于 2019-12-10 03:14:20
问题 I am having a hard time to change the text size of a switch compact thumb. Here's my layout: <android.support.v7.widget.SwitchCompat android:id="@+id/switch_compat2" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="20dp" android:checked="true" android:switchTextAppearance="@style/MyStyle" android:text="SwitchCompat (SDK v7+)" app:showText="true" /> and the style: <style name="MyStyle"> <item name="android:textColor">#229922</item> <item name=

How can I get the correct DisplayMetrics from an AppWidget in Android?

社会主义新天地 提交于 2019-12-10 03:06:56
问题 I need to determine the screen density at runtime in an Android AppWidget. I've set up an HDPI emulator device (avd). If set up a regular executable project, and insert this code into the onCreate method: DisplayMetrics dm = getResources().getDisplayMetrics(); Log.d("MyTag", "screen density " + dm.densityDpi); This outputs "screen density 240" as expected. However, if I set up an AppWidget project, and insert this code into the onUpdate method: DisplayMetrics dm = context.getResources()

Debugging Android Widget Code In Eclipse

折月煮酒 提交于 2019-12-10 01:47:58
问题 I am starting with Android programming with the help of Unlocking Android / Manning which came from Santa and is a pretty good book. After running a few little tests and examples, I'm moving towards developing the concepts for my own application. I want my App to execute as a Home Widget and I'm using this example as my model to get started. While I am able to load and run in the Android ADB emulator the code example in the example's Wiktionoary which is a normal Android App. I am not able to

Disable collapsing of ExpandableListView

谁说胖子不能爱 提交于 2019-12-10 01:16:27
问题 The default behavior of ExpandableListView is to collapse a group when its header is clicked. Is it possible to prevent this from happening? I've tried: Setting OnTouchListener on the list. This interferes with scrolling. Setting an OnGroupClickListener on the list (in onCreate() ). This works for all clicks after the first. Has anyone else accomplished this? Why might the OnGroupClickListener miss the first click? Thanks in advance for your suggestions. 回答1: You can ignore click on group

How can I add WebView into a Widget?

有些话、适合烂在心里 提交于 2019-12-10 01:10:00
问题 I'm trying to make a recording Widget where the user interface would be loaded from HTML page in WebView. Is this possible? I've been trying to load url into Widget but I get all sorts of errors and my program crashes. I'm new to Android development and don't really know how this stuff works yet. This is my Widget provider class: public class RecordAppWidgetProvider extends AppWidgetProvider { WebView webview; @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager,

Android: How to use NumberPickerDialog

南笙酒味 提交于 2019-12-10 00:25:43
问题 Could someone give me an example of how to instantiate a NumberPickerDialog within Activity.onCreateDialog ?(https://github.com/novak/numberpicker/blob/master/lib/src/com/michaelnovakjr/numberpicker/NumberPickerDialog.java) ? There are examples in a repo called numberpicker-demo for using the widget, but none for the actual dialog. Amongst other approaches I've tried tried something like: return new NumberPickerDialog.Builder(this) .setTitle("Choose Number") .etc.. But this just shows a

Permission Denial for intent to external activity

我与影子孤独终老i 提交于 2019-12-09 23:36:12
问题 My whole idea is a little more complex, but just to break things down so they're simple and to the point here...I have a button on a widget that i need to open the "places" activity in the official facebook app. Here's the code i'm using: Intent PlacesIntent = new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_LAUNCHER).setComponent(new ComponentName("com.facebook.katana", "com.facebook.katana.activity.places.PlacesNearbyActivity")); PendingIntent pendingIntent = PendingIntent

How to make custom Indeterminate ProgressBar

家住魔仙堡 提交于 2019-12-09 22:05:39
问题 How can I change style of indetermine ProgressBar in Android I need to change color to RED for this progressbar: Can anybody help me? 回答1: I got the android source code so I saw how they build de spinner loader, and it's very eassy just two steps 1- create a drawable resource in your drawable folder with you image like below (and named it f.i my_loader) <animated-rotate xmlns:android="http://schemas.android.com/apk/res/android" android:drawable="@drawable/your_image_loader" android:pivotX="50

android custom Switch widget for SwitchPreferenc

徘徊边缘 提交于 2019-12-09 19:01:07
问题 I search around stackoverflow and find next related topics: How can i style an Android Switch? Custom switch widget in Android 4 Set switchStyle - get error resource not found - why? I also find bugreport on google group: Issue 36636: Unable to override style switchStyle And at last find new probles with Switch widget: I tried to make my own Preference.SwitchPreference and define layout with Switch widget android:id="@+android:id/switchWidget" android:layout_width="wrap_content" android

Android onEnabled/onDisabled never called

て烟熏妆下的殇ゞ 提交于 2019-12-09 18:20:56
问题 I'm having a problem with triggering of the onEnabled and onDisabled methods of the AppWidgetReciever. I have the actions specified, I also log every action in onRecieve method, but the only two actions I get are "APPWIDGET_UPDATE" and "APPWIDGET_DELETED". I have googled for this solution, but unfortunately found none. Here is my code: Manifest part: <receiver android:name=".ScheduleWidgetProvider" > <intent-filter> <action android:name="android.appwidget.action.APPWIDGET_ENABLED" /> <action