android-widget

Gradients and shadows on buttons

南楼画角 提交于 2019-12-18 05:16:10
问题 Is it possible to programatically, or via xml configuration (and not via 9patch png), to achieve the effects as seen on Springpad widget: If you look closely, there's a sharp border/line between the upper (brighter) and lower (darker) gradients. Also, there are inner and outer shadows for that embossed area on the right. I know how to set gradient background on a button, but that gradient is constant, without that sharp line in the middle. Also, I couldn't find any reference on shadow

RemoteView addView not working

爱⌒轻易说出口 提交于 2019-12-18 04:46:12
问题 I have an app widget and I'd like to add Views ( TextView , etc.,) to the RemoteView but it never shows up. Here goes the code: RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_layout); RemoteViews newView = new RemoteViews(context.getPackageName(), R.layout.widget_row_layout); newView.setTextViewText(R.id.textUser, "1234"); views.addView(views.getLayoutId(), newView); // Tell the AppWidgetManager to perform an update on the current App Widget appWidgetManager

Application Launcher Text - Application Name in two lines

情到浓时终转凉″ 提交于 2019-12-18 03:55:35
问题 Currently i am developing an application whose name is long , so i would like to display name in two line same as "Quick Calendar" and "Search People" in an attached home screen widget: Please show me a way to implement this ?? is it possible to do so? 回答1: Use \\n for a newline character. 回答2: Use \n \r but remember to enclose the string in quotes "... \n ... " 来源: https://stackoverflow.com/questions/4345920/application-launcher-text-application-name-in-two-lines

How to catch widget size changes on devices where onAppWidgetOptionsChanged not getting called?

本小妞迷上赌 提交于 2019-12-18 02:54:50
问题 Devices like Samsung Galaxy S3 working with Android version 4.1.2 has a bug which prevents onAppWidgetOptionsChanged to be called. So, how can we get information related to changed sizes? 回答1: I am adding to Frankish's answer with how I handle receiving this broadcast: @Override public void onReceive(Context context, Intent intent) { // Handle TouchWiz if(intent.getAction().contentEquals("com.sec.android.widgetapp.APPWIDGET_RESIZE")) { handleTouchWiz(context, intent); } super.onReceive

“_Problem Loading Widget” message

喜欢而已 提交于 2019-12-17 22:55:24
问题 When loading a widget if it cannot find a resource or something it says Problem Loading Widget. That's all! Amazing! This message remains on the home screen and does not even say which widget it had trouble loading. I figured it out by trial and error but I would like to know if there are any places to find the error message when this occurs. Where will Android say what problem it had loading the widget or even which widget it failed to load? 回答1: As said in comments, check logcat. What you

Suggestions for building a treeview control in Android

爷,独闯天下 提交于 2019-12-17 22:34:41
问题 Suggestions for building a treeview control in Android 回答1: The ExpandableListView is probably the closest existing thing. Keep in mind though that it might be hard for a user to fat finger a tree view. 回答2: I built a treeview of my own which supports n levels. It's easy to use in touch screens, especially on devices with larger screen. I Used a class which extends ListviewAdapter and created my own listitem . the items know on which level they are and they inherit the expandstate of their

is it possible to show widget only for a certain android version?

淺唱寂寞╮ 提交于 2019-12-17 22:33:10
问题 is it possible to show widget in "Add to home screen > Widgets" Dialog only for a certain android version without uploading two APKs and assigning to proper SDK version numbers? 回答1: I have a way to do it without any code e.g.: In your res\values dir create a bools.xml file: <?xml version="1.0" encoding="utf-8"?> <resources> <bool name="honeycombOrAbove">false</bool> </resources> Create a values-v11 dir (for honeycomb or above values), copy the file to it and set the value to true. Then in

How to consume reusable gui element/widget with resources in android

北战南征 提交于 2019-12-17 21:35:32
问题 I try to use the dateslider in my android project to have a combined date-time picker im my gui. The authors of the widget suggest to include the java- and resource-sources directly into my app. 1st try copy java and resources into main app: Result: The widget java classes cannot compile because the resourceids R.xxxx cannot be resolved. Reason: The widget classes are implemented in package "com.googlecode.android.widgets.DateSlider" and my app has a different namespace "my.namespace.myApp"

How to set corner radiuses for the button in java code?

爷,独闯天下 提交于 2019-12-17 20:58:09
问题 I want to set the rounded corners without xml. How can I do it in java code? Button b = new Button (this); b.set???? (??) ; I tried to write b.setCornerRadius(3.0f), but it is undefined for button object. Thanks. 回答1: create a shape in your drawable folder and set the desired radius and set this drawable as background to your button: <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape android:shape="rectangle"> <corners

How can i place double click event on ImageView in Android

痴心易碎 提交于 2019-12-17 20:58:00
问题 I have to place an double click event on Image view..Whenever I double click on Image ,It sshould be Zoom.But I found that there is no such event like double click in Image Veiw. Can Anyone Tell me How To DO it?? Thanks in Advance.. 回答1: Try this approach: add boolean doubleClick = false; and Handler doubleHandler in onClick check if doubleClick is true if true, it is a double click if not, set doubleClick to true and use the handlers postDelayed to set it back to false after i.e. 500ms 回答2: