android-widget

How to make a TextView editable at the click of a button?

亡梦爱人 提交于 2019-12-13 22:34:13
问题 I have an app that displays certain content from a database and lets users edit it. I have an activity that displays those details in some textviews. Now, there is an "EDIT" button at the bottom of the screen. When this button is clicked, I want to make the textview's editable (which are initially read-only) so that the database can be updated. Also, I want the "EDIT" button to turn into a "SAVE" button. I understand I can just use another activity for this, but is there any way to do this

Widgets and setOnClickPendingIntent

久未见 提交于 2019-12-13 18:23:44
问题 Complete android development newbie here, be warned. I'm trying to develop a homescreen widget that allows you to tap the widget to call a predefined number. I can create the widget and add it to the homescreen just fine, however, when I try to make the widget clickable using setOnClickPendingIntent , it does not launch the activity. The code I am using is provided below: public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { RemoteViews remoteViews =

AutoCompleteTextView without dictionary hints

六月ゝ 毕业季﹏ 提交于 2019-12-13 17:21:00
问题 I have an Autocompletetextview field. The problem is that in portrait view, in addition to the suggestions from my array that show up top, a bar pops up below with suggestions from a dictionary. I can't seem to figure out how to disable those. 回答1: In your XML try, inputType="textNoSuggestions" . From the Developer doc: textNoSuggestions - Can be combined with text and its variations to indicate that the IME should not show any dictionary-based word suggestions. Corresponds to TYPE_TEXT_FLAG

What is the state of a spinner when it's displaying a drop down list?

心已入冬 提交于 2019-12-13 17:04:56
问题 I am creating a spinner with a custom view, anyway I managed to show different drawables for when the spinner is inactive and also for when it's pressed, I would like to keep the pressed state drawable when the dropdown list shows. Here is mi XML file: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/ComboBoxInactive" /> <item android:state

android:layout_width along with layout weight usage

假装没事ソ 提交于 2019-12-13 16:08:37
问题 why should i put android:layout_width="0px" when i use a ndroid:layout_weight property? For example following is my main.xml file , and in that i used android:layout_width="wrap_content" , and everything works fine, so why android:layout_width="0px" should be used when i am using the layout_weight property? <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"

How to localize Android DatePicker?

 ̄綄美尐妖づ 提交于 2019-12-13 15:55:09
问题 I put the DatePicker on my Activity . Everytime I launch my app I see english version of date in the DatePicker widget: Oct 15 2012 . But I want to have a local version of date (russian) when I start my Activity. I've tried to define the locale before UI initialization. But it doesn't help. Is there any possibility to make it without extending DatePicker class? 回答1: In fact there is no need to override this class. But when I started to do it, I found info about special method "reorderpickers"

Android ImageView NullPointerException

谁都会走 提交于 2019-12-13 13:27:08
问题 I have two images, a red light and a green light. I have a custom ListView that I would like to display a red light when a list item is inactive, and a green light when it is active. A list item is activated when it is pressed. Here is my code row.xml <ImageView android:id="@+id/iconLight" android:src="@drawable/light_off" android:layout_width="wrap_content" android:layout_height="wrap_content"/> main.java ImageView iconLight = (ImageView)findViewById(R.id.iconLight); iconLight

Overriding dropdown list style for Spinner in Dialog mode

随声附和 提交于 2019-12-13 13:12:24
问题 I need to override List of dropdown spinner items when Spinner id in dialog mode (android:spinnerMode="dialog"). I need this to define my own list divider. I have found dropDownListViewStyle item in application Theme, which contains divider item. And it works, but only for android:spinnerMode="dropdown". Can I have the same effect for "dialog" mode? 回答1: Try this: <Spinner android:id="@+id/spinnerAddToList" android:layout_width="0dp" android:layout_height="0dp" android:layout_marginTop="10dp"

Android 5.0 (Lollipop) widget button's text are in ALL CAPS [duplicate]

耗尽温柔 提交于 2019-12-13 13:09:22
问题 This question already has answers here : Why is my Button text forced to ALL CAPS on Lollipop? (20 answers) Closed 5 years ago . I have a simple homescreen widget with a few buttons on it. My problem is that when the widgets are running on Lollipop the button's text are all capitalized, any previous Android version doesn't have this problem. The buttons in the layout.xml are very ordinary buttons: no styling or special sauce, just a width height and text size. The interesting thing is that

android:there are a listview in ScrollView so listview Scrolling not happend.

社会主义新天地 提交于 2019-12-13 09:46:02
问题 I have this type of layout <LinearLayout> <ScrollView> <LinearLayout> <ImageView/> <button> <ListView> </LinearLayout> </ScrollView> So in this Case my List view Scrolling not happens and my View Scrolling is perform i want also perform Listview Scrolling when data is more. and List view is need to put in Scroll view parent layout so how can solve this problem please help me. 回答1: Never put a ListView inside of a ScrollView . Never . You have two options: If you don't necessarily want the