android-widget

Date and time picker in one view

半世苍凉 提交于 2019-12-22 08:24:00
问题 I wanted to know whether we can implement both date and time picker in one view... In our iPhone app you can pick both date and time through one view. But in Android we have date picker and time picker used separately. Is there any method by which I can get values of both date and time from one view? 回答1: There is no built in widget that implements both a date and time picker. However, you can create your own custom view for that, perhaps combining the existing DatePicker and TimePicker . 来源:

Widget preview image

谁都会走 提交于 2019-12-22 06:59:18
问题 My app preview image looks like this: How can I make it look like the WhatsApp Chat preview, small with shadow. Also other apps in my phone use the same type of preview. My widget xml: <?xml version="1.0" encoding="utf-8"?> <appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android" android:initialLayout="@layout/appwidget" android:minHeight="40dp" android:minWidth="320dp" android:previewImage="@mipmap/ic_launcher" android:updatePeriodMillis="300000" > </appwidget-provider>

Android: a vertical gallery?

戏子无情 提交于 2019-12-22 05:34:09
问题 I'm looking for a widget that behaves similar to the gallery widget but scrolls vertically instead of horizontally. I googled all around and apparently the answer is no such pre-made widget exists. So I said myself, oh well, I'll look at the gallery class in the android source and modify that to scroll vertically instead. Not so easy. The android SDK hides a lots away (understandably for framework maintenance), but it also makes it very hard to extend the widgets. The gallery class, for

ListView items don't become visually “highlighted” when selected during contextual action mode

回眸只為那壹抹淺笑 提交于 2019-12-22 04:35:31
问题 I followed the official Android site's tutorial on creating contextual action menus. Using the code below, when I long press on one of my ListView items, it does become selected, but it does not visually indicate that its been selected. I am using the Holo Light theme, and I expect the background color of every selected item in my ListView to change to a shade of blue. Is this normal behavior? I have tried testing listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE); and not even a single row

OnClickListener() must override a superclass method?

大憨熊 提交于 2019-12-22 04:07:31
问题 With this code: import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; . . . Button buttonAuthorizeUsers = (Button) findViewById(R.id.buttonAuthorizeUsers); buttonAuthorizeUsers.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent configure = new Intent(OnDemandAndAutomatic_Activity.this, Configure_Activity.class);

OnClickListener() must override a superclass method?

倖福魔咒の 提交于 2019-12-22 04:07:14
问题 With this code: import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; . . . Button buttonAuthorizeUsers = (Button) findViewById(R.id.buttonAuthorizeUsers); buttonAuthorizeUsers.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent configure = new Intent(OnDemandAndAutomatic_Activity.this, Configure_Activity.class);

Change buttons' order of DatePickerDialog for Android 4.0.3

99封情书 提交于 2019-12-21 23:09:45
问题 I created an DatePickerDialog : DatePickerDialog datePickerDialog = new DatePickerDialog(getActivity(), this, year, month, day); and show it On Android 4.0.3 (API 15) device, it looks like this: As you see above, the " cancel " button is displaying on the left-hand side while the " Set " button is on the right-hand side. But on Android 2.3.3, the button order is the other way around. So, how can I change the buttons' order of DatePickerDialog in order to show " Set " button on left-hand side,

how to set anchor tag mailto: attribute in webview, android

蓝咒 提交于 2019-12-21 19:43:24
问题 I tried to set anchor tag mailto attribute like <a href='mailto:info@company.com'>info@company.com</a> in webview. when i run the app on simulator and click on the link it is showing "Unsupported Action .." How i can set mailto attribute work out in android webview.... Thanks 回答1: WebView does not support advanced HTML tags... what you will have to do is: Set a webclient to your webview and override the url loading When you detect a link with mailto try to send the email. I'm gonna give you a

Android - Multiple appWidgets playing different sounds

纵然是瞬间 提交于 2019-12-21 17:22:14
问题 I'm writing an android soundboard wich allow the user to create multiple desktop widgets, one for each sound. I'm using an activity for the user to choose wich sound he wants to create the widget for. For each widget created i store a shared preference in the form of key => "WIDGET_FILENAME_"+widgetId, value=> fileName To play the sounds, i did override the onRecieve method on the widgetProvider class. When the desktop widget is clicked, it triggers a broadcast to this method, wich gets the

Is possible to customize positive and negative buttons in AlertDialog?

懵懂的女人 提交于 2019-12-21 16:53:53
问题 Is possible to customize positive and negative buttons in AlertDialog ? I need to replace default look of positive and negative with custom. .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {... .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {... Can somebody tell me how to do that ? 回答1: public class ComentarDialog extends DialogFragment{ @Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder