How to make widget with something like ListView. I've made it using LinearLayout but I don't know how to discover amount of rows. (I want to know exact amount of rows to make widget able to paging)
I want it to look like this (photoshop and copypast):
Notes:
Android 2.3.4 and below.
widget of size 4x4
UPDATE AND CLARIFICATION:
When I said "scrollable" I mean scroll by click on UP and DOWN buttons (you see it on the screenshot) ie paging
I do not know how to determine real size the widget 4x4 in dp. It seems that it can be determined only by knowing the specific device.
You can scroll by fixed number of rows.
The only pre 3.0 example with source I know of is the ScrollableContacts project on Google Code. It features a scrollable list in a home screen widget and works from 2.1. However, the widget requires a home replacement - see the project description. The source can be viewed here.
Related
On Twitter for Android there is a bar at the top of the display where the user can swipe left and right between three different screens: Home, Discover and Activity (see image 1).
As they do so, the small blue line moves in real time to underneath the name of the screen that has been selected (see image 2).
When the user scrolls downwards, the entire bar collapses to the size of the blue line and it remains that way until the user scrolls up again.
Can this be achieved in xCode, ideally in Storyboard? If not, what is the best alternative?
Apologies for the massive images...
I have built this as an ios feature before (also an android dev so I know where you are coming from).
Here is the DIY way;
Use a UIScrollView and with the pagingEnabled property set to YES. Typically a UIPageControl is used along with it.
Here is a Library that does it for you;
https://github.com/monsieurje/ICViewPager
Hope this has answered all your problems.
I've problem, that i want to create a home screen widget with listview inside, which should be scrollable. I read on docs page, that listview is only supported in remoteview from 3.0 android.
But still i think, this is not completely true, or i am missing something. Ok, when i tried do add listview to my home screen diget, i get error: class not allowed to be inflated android.widget.listview. BUT on my phone i have android 2.2.3 and i am able to add home screen widget (its some email application widget) which shows SCROLLABLE list of my emails, look here:
http://i50.tinypic.com/2gslq2q.png
And my question is: How is this possible and how to do it, in which way? Im googling few hours, but have absolutely no idea how is this possible (maybe dynamically generate items int vertical linear layout and create manualy scroller on right side, but it sound terrible complicated).![enter image description here][1]
EDIT: maybe its possible to generate long list of items into linear layout and detecting, if user is moving up or down with finger...
I read on docs page, that listview is only supported in remoteview from 3.0 android.
Correct.
i am able to add home screen widget (its some email application widget) which shows SCROLLABLE list of my emails
That is not an app widget. That is a feature of that home screen implementation.
maybe its possible to generate long list of items into linear layout and detecting, if user is moving up or down with finger...
No, sorry.
I already know that ListView is not supported in widgets until HoneyComb. But Foursquare's widget uses ListViews even on API 4 (see the picture).
Is there any way to implement ListView for Widgets in API 4? I've searched document and more nothing mentioned about ListView in Widgets.
When I tried to use, always got inflating error.
I'm curious about suggestions and examples.
I have done something similar to this in one of my widgets. Listview is not supported in API 4, and while this "looks" like a ListView it is not. Its just cleverly positioned images, and text and a border around them that looks like a ListView does.
The arrows are images that when clicked tell the widget to go rerender all the stuff in the "ListView". So it sort of gives an approximation of a ListView on older devices, but you need to use arrows to change the content instead of flicking on the ListView.
I am making a quiz application in which i am planning to use the SlidingDrawer control for displaying different question numbers. Clicking on a number will allow the user to jump to a specific question.
I have implemented the sliding drawer control but it is able to display only 6-7 buttons inside it depending on the screen size. Trying to add more buttons to it gives an exception.
I tried using a GridView inside the SlidingDrawer but i keep getting an error.
Is there anyway i can have around 20-30 buttons inside the SlidingDrawer control arranged in a grid like manner ?
Please give suggestions on any other way i can implement similar functionality in a way that doesn't take up much screen space ?
Yes, it's possible, as a matter of fact previous Android versions (1.6 if I'm not wrong) implemented the application Launcher that way.
Search the source for that version and you'll have a working sample.
As far as I have read in the Internet and official documentation, it isn't possible to make a scrollable app widget. Also all my tries failed. I even tried to subclass TextView to implement my own scroll method, but nothing worked.
Are there any ways to achieve that?
Btw.... there are solutions if you use for example htc sense or home desktop ++, but i want to make it available to other users which don't use this
Are there any ways to achieve that?
Not directly. You can always add buttons to rotate you through various options. But true scrolling is not possible.
HTC provides scrollable app widgets because these are built-in. Only their Launcher can create and display them. Regular app widgets do not support scrolling.
As far as I have observed, app widgets are scrollable, but only in the vertical direction.
For Eg. The calendar widget is a scrollable widget which comes with mostly all android phones.
Only the vertical scrolling is allowed for the fact that horizontal scrollings are required to change the screens in the home page.
It is said only 2 gestures are allowed for a widget,
1.Touch
2.Vertical scrolling.
Source : Developer's Page
Now you can make a scrollable widget, but you'll have the problems with images within it. Workaround is described here.