Questions tagged [android-widget]

Either relates to Home Screen widgets, or to general UI elements used on an Android Application screen.

From Android Documentation

Widgets are an essential aspect of home screen customization. You can imagine them as "at-a-glance" views of an app's most important data and functionality that is accessible right from the user's home screen. Users can move widgets across their home screen panels, and, if supported, resize them to tailor the amount of information within a widget to their preference.

Common elements are :

  • AbsoluteLayout
  • AnalogClock
  • AutoCompleteTextView
  • Button
  • CalendarView
  • CheckBox
  • CheckedTextView
  • Chronometer
  • CompoundButton
  • DatePicker
  • DigitalClock
  • EditText
  • ExpandableListView
  • FrameLayout
  • Gallery
  • GridView
  • HorizontalScrollView
  • ImageButton
  • ImageSwitcher
  • ImageView
  • LinearLayout
  • ListView
  • MediaController
  • NumberPicker
  • ProgressBar
  • QuickContactBadge
  • RadioButton
  • RadioGroup
  • RatingBar
  • RelativeLayout
  • ScrollView
  • SearchView
  • SeekBar
  • SlidingDrawer
  • Spinner
  • StackView
  • TabHost
  • TableLayout
  • TableRow
  • TabWidget
  • TextSwitcher
  • TextView
  • TimePicker
  • Toast
  • ToggleButton
  • VideoView
  • ViewAnimator
  • ViewFlipper
  • ViewSwitcher
  • ZoomButton
  • ZoomControls
5711 questions
2
votes
0 answers

"Problem loading widget" when using custom color attributes

We developing home screen widgets in 2021 and I tried to implement dark theme support. According to https://developer.android.com/guide/topics/ui/look-and-feel/darktheme#widgets "... use appropriate theme attributes instead of hardcoded colors." So…
2
votes
1 answer

Button press add new row to a ListView programmatically, how to?

My main layout main.xml has only a Button, a EditText and an empty ListView as below:
Mellon
  • 37,586
  • 78
  • 186
  • 264
2
votes
1 answer

ImageView's Drawabale tint is not working in Widget

I am creating a widget, but when I add app:tint="@color/white" it's showing tint in the Design Preview but when the widget loads the tint is not applied, the icon is still black, i need to add white tint to the imageview.
2
votes
1 answer

How to inflate a activity in my case?

I would like to achieve this layout : my main activity layout (main.xml); (Please mouse right click the following image and view image) I have made another ContentActivity (with content set to content_one.xml) which is supposed to be used as part…
Mellon
  • 37,586
  • 78
  • 186
  • 264
2
votes
2 answers

How to remove old content and show new content when using LayoutInflater in my case?

My main.xml layout simply contains two buttons and a content area, which shows below:
Leem
  • 17,220
  • 36
  • 109
  • 159
2
votes
1 answer

Android Widget forcing RemoteView to clear cache?

I'm developing a widget where the portrait and landscape layouts are saved in /layout and /layout-land respectively. each layout file is named the same, but has been modified for formatting changes based on their orientation differences. When I…
nihonnik
  • 162
  • 1
  • 1
  • 8
2
votes
0 answers

Make a "pull up to get more" for a list on the Android

I just successfully used the Pull To Refresh by johannilsson in order to pull down a list to update it. Now I am trying to make basically the same concept to pull up a list from the bottom in order to trigger getting more items from the server…
2
votes
1 answer

Home screen widget with dynamic size

Is it possible to create a Home Screen widget dynamically (that is without defining a fixed layout in project resources)? Currently I have 4 layouts - but to cover all options I'll need at least 15 different layouts with different width / height…
pocketDev
  • 205
  • 2
  • 10
2
votes
1 answer

ImageButton inside Android ListView with BaseAdapter

I have implemented a BaseAdapter and binded that BaseAdapter to my ListView. The Layout for each row of the ListView contains an ImageButton. How do i bind that ImageButton to a click listener and then use that ImageButton to call a new activity.
Sultan Saadat
  • 2,268
  • 6
  • 28
  • 38
2
votes
2 answers

Start activity by clicking on whole Widget is not working in Android Studio

I have a created widget and set on click Intent for FrameLayout. Actually I tried for all layouts like LinearLayout, RelativeLayout but no success. I am having a hard time figuring out how to make my app open by click anywhere on widget. Also i used…
Dev D
  • 37
  • 1
  • 1
  • 3
2
votes
3 answers

Android newbie: switch between landscape mode and portrait mode

I followed the android developrs tutorial to create a simple tab layout. Everything is fine with the tutorial, I got the tab layout working. In default portrait mode, the tabs are located on top of screen, but when change to landscape mode, the tabs…
Leem
  • 17,220
  • 36
  • 109
  • 159
2
votes
2 answers

Newbie: gallery show only one image each time

I have followed the android gallery tutorial to build a simple gallery which is exactly the same as the tutorial's. Now, I would like to improve the gallery from the tutorial to show only one image at one time(in the tutorial, several images are…
Leem
  • 17,220
  • 36
  • 109
  • 159
2
votes
1 answer

Android newbie, why my nested tabs not working?

I am a newbie in Android app development, I tried to create a nested tabs. That's I firstly create three tabs, then I define the content of the first tab to be another tabs activity. What I did is illustrated below: I defined main tabs activity(…
Leem
  • 17,220
  • 36
  • 109
  • 159
2
votes
0 answers

battery draining issue when widget is created for my app

In my application I used the widget creation code for displaying alerts every 10 minutes. For updating the widget I need WIFI. But when I run the application, it frequently gives the error time battery draining issue. Any suggestions?
Pinki
  • 21,723
  • 16
  • 55
  • 88
2
votes
1 answer

Set scroll range of Android ScrollView

I was wondering if it was possible to set the scroll range of the android ScrollView. Basically I have a scroll view with one child in it that extends 100 pixels past the bottom of the screen. Normally the scroll view will scroll till it gets to the…
Sam
  • 21
  • 2