android-widget

Android FragmentTransaction: How to generate an overlay slide in and move existing Fragement to left

做~自己de王妃 提交于 2019-12-09 06:49:41
问题 I'm trying to do the following. Create a new Fragement B (Menu), slide it in from the right, and i want to move (no hide or replace!) the already shown Fragment A to the left. I got the Transaction from Fragment B right, but Fragment A doesn't change his position at all. Seems like, my FragmentManager doesn't know that Fragment A exists (Fragment A is not added dynamically, it's defined in XML). main_screen_layout-xml <RelativeLayout //... android:id="@+id/main_screen" tools:context="

Resizing/Scaling Down Android Widgets (DatePicker and TimePicker)

大憨熊 提交于 2019-12-09 05:09:15
问题 I'm not sure if this is possible, and I couldn't find a topic based on it, but if it's been answered before drop me a link and that will be that. What I'm looking to do right now is resize some of the default Android widgets, specifically DatePicker and TimePicker, to use in an Activity. But as far as I can see the only result of modifying the width or height of either Picker (in a negative direction) results in a cropped view, rather than a scaled/stretched view of the widget. I am open to

implement android:src=“@drawable/image” programmatically in Android

拈花ヽ惹草 提交于 2019-12-09 04:17:30
问题 I am trying to set the foreground image on an image button. After some research, I came across this code sample: <ImageButton android:text="Button" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/icon"/> My query is how to actually implement android:src in code. 回答1: Try this: ImageButton btn = (ImageButton)findViewById(R.id.button1); btn.setImageResource(R.drawable.newimage); where newimage is the image name in

How to create an inbox style (with unread count) widget for android?

吃可爱长大的小学妹 提交于 2019-12-09 01:45:46
问题 I am trying to create a widget for my android app. I want it to be a single cell but with an annotation in the top right. Similar to popular widgets which display an unread email/sms count in the top right. This seems like it would be a common thing to try and do but I can't find any examples of how to build this. How do I do this? Or what resources are there to teach me how to do this? Thanks, Robin 回答1: Im not sure whether you are asking how to build a widget in general or just for the

Android: How to place an animated image inside an EditText that we can show and hide

别等时光非礼了梦想. 提交于 2019-12-09 01:02:08
问题 I am trying to add an animated spinner inside a EditText view to the right. And programmatically show/hide it. I have created the animated spinner by introducing a linear interpolation rotation: res/anim/rotate_forever.xml <?xml version="1.0" encoding="UTF-8"?> <rotate xmlns:android="http://schemas.android.com/apk/res/android" android:fromDegrees="0" android:toDegrees="360" android:pivotX="50%" android:pivotY="50%" android:repeatCount="infinite" android:interpolator="@anim/linear_interpolator

How can I write my own context menu for copy & paste?

∥☆過路亽.° 提交于 2019-12-08 23:58:47
问题 I'm writing an application with EditText driven widget. and I'd like to create my own copy & paste menu. To replace android default menu on EditText, what should I do? Just overriding long click? or is there another way to implement? Thanks in advance. 回答1: EditText should already have a context menu enabled. If it were not, then you would have to enable it by calling registerForContextMenu. Once you have the context menu enabled, you have to add items to it. This is done in

widget doesn't refresh after configuration changes

感情迁移 提交于 2019-12-08 17:09:49
问题 I wrote an AppWidget for my app that you can choose a name of place you like and it shows you a pic from that place. It has a configuration Activity (I used the same configuration activity of the app itself) when first added, the widget and the it's configuration handeling works fine: I choose a place I like and I see the pic; Problem is Whenever I restart the device(or it goes out of sleep mode) then when I click on it(the widget) I go into the configuration activity - change to the desired

Android widget with ListView doesn't load items correclty

可紊 提交于 2019-12-08 16:53:45
问题 I'm trying to implement a widget for my app with ListView. To do so, I've gone step-by-step in all the following links: Android app widget with list view Using App Widgets with collections - developer.android.com/guide/topics/appwidgets/index.html#collections Filling ListView in homescreen widget in Android - stackoverflow.com/questions/14121602/filling-listview-in-homescreen-widget-in-android However, when I place the widget on the homescreen, the number of list items does match the number

Error : Your TabHost must have a TabWidget whose id attribute is 'android.R.id.tabs

梦想与她 提交于 2019-12-08 16:47:48
I'm new to Android and developing. I'm using Tab host widget. What I'm doing is I made 3 Java classes and corresponding xml files. Each Java class can load its xml. When someone presses the tab then it redirects to above Java classes. Please find the below code that I used.Now im getting Errors please find below code I used. CompareActivity.java package com.example.comparison.lk; import android.os.Bundle; import android.app.ActionBar; import android.app.Activity; import android.app.TabActivity; import android.content.Intent; import android.graphics.drawable.ColorDrawable; import android

not onUpdate in AppWidgetProvider

你。 提交于 2019-12-08 13:04:29
问题 My Android widget is not updating the date. It's a widget with only date, no more. package com.android.widget; import java.util.Timer; import java.util.TimerTask; import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetProvider; import android.content.ComponentName; import android.content.Context; import android.widget.RemoteViews; public class MyCalendarWidget extends AppWidgetProvider { @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager,