android-widget

Android App Widget - Button to change TextView content

核能气质少年 提交于 2019-12-19 11:06:09
问题 I'm a little confused with Android app widgets. I understand that I can create a button to start an activity, but I don't see how I can create a button to edit the text of a TextView inside the widget. Can someone please tell me what I'm missing? Thanks a lot in advance. EDIT: I don't mean for the user to input the new text, I mean for the application to change the text automatically, without any UI (i.e., dialog boxes or activities). 回答1: EDIT: OK, so you set a getBroadcast PendingIntent on

textView without any default padding while increasing size of textView [duplicate]

﹥>﹥吖頭↗ 提交于 2019-12-19 10:32:36
问题 This question already has answers here : Android: TextView: Remove spacing and padding on top and bottom (17 answers) Closed 3 years ago . I want to remove default padding on textView. when i increase the size of textView then it's padding size increases automatically. even i set background of text View as "@null". i just want to show only text without any padding. my View looks like this first images and i want to show like second images. first image second image 回答1: Maybe this help you

How to know clicked widget id?

半城伤御伤魂 提交于 2019-12-19 10:21:51
问题 I have implemented a widget with an ImageButton and a TextView . That ImageButton launch an activity when its clicked. This activity updates the widget text with what the user writes on the activity EditText . Now the problem is that I only know how to get the ids like this: for (int widgetId : allWidgetIds) { // Create some random data int number = (new Random().nextInt(100)); RemoteViews remoteViews = new RemoteViews(getApplicationContext() .getPackageName(), R.layout.widget_layout); Log.w(

Please help with very simple android widget button click. Getting very frustrated. :(

[亡魂溺海] 提交于 2019-12-19 09:05:50
问题 I have poured over every example that I can find and I have gone through the official documentation from google. All I am trying to do is create a toast notification from a button click on a widget. I can get the widget (and button) to appear but I can't get my intent to fire. I have seen several examples that show doing this different ways but I just can't get it to work. I haven't felt this helpless with coding in a long time and I'm starting to feel dumb. This is what I have so far: public

RelativeLayout Gravity not applied?

徘徊边缘 提交于 2019-12-19 06:35:38
问题 I have an activity with the following layout : <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/testlayoutOverlays" android:layout_width="fill_parent" android:layout_height="fill_parent" > <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/testlayoutMain" android:layout_width="fill_parent" android:layout_height="fill

RelativeLayout Gravity not applied?

南笙酒味 提交于 2019-12-19 06:35:19
问题 I have an activity with the following layout : <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/testlayoutOverlays" android:layout_width="fill_parent" android:layout_height="fill_parent" > <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/testlayoutMain" android:layout_width="fill_parent" android:layout_height="fill

“…must supply a layout_height…” but its in my style resources?

谁说我不能喝 提交于 2019-12-19 05:13:12
问题 I had a working app on 2.1 and above until I tried to cleanup my initial layout with a theme of styles. Now the app won't even start with the "You must supply a layout_height attribute" failure message pointing to my first EditText View in the layout. Why can I not move the 'layout_height=30dp" that was working fine on every EditText into an ... item name="android:layout_height">30dp< ... in a style referred to via my theme? Virtually all my other style effects I abstracted out like this are

Creating Custom Alert box in android

荒凉一梦 提交于 2019-12-19 04:16:09
问题 I know this is been answered many times but i am unable to find any good resource for this. Can any one tell how to create Custom Alert box for android??. What i want is a nice looking alert box with few images text etc which will be basically mu application info. I know how to create simple alert box. Please point me to any sample code if possible Thanks Pranay 回答1: Just create any Activity you want with whatever layout you want, and apply android:theme="@android:style/Theme.Dialog" to your

Rotate and scale a view based on one handle in Android

大兔子大兔子 提交于 2019-12-19 04:14:22
问题 I'm trying to rotate and scale a view based on one "drag" handle in Android. With the layout rotating, and the view resizing, the end result should be that the drag handle follows the users finger where ever it moves. This is based on combining these two questions: How to scale a view in android using a handle? Rotating around two points in android not working The only thing that seems wrong is the rotation code. Here is my activity code: public class MainActivity extends Activity { ImageView

Horizontal scrolling in android gridview

落爺英雄遲暮 提交于 2019-12-19 01:09:24
问题 I have a grid view in my application and i need to scroll it horizontally.I have tried changing the gridview to gallery.But then only one row is available,but i need different rows as in a grid view.So basically what i need is a gridview that can be scrolled horizontally.Is there any efficient way to do this?Thanks in advance. Regards Anu Hi,Thanks for the reply.i have tried using a Gallery and implement an adapter that provides a multirow view in its getView method. My java file is: public