Android - scrollable listview in home screen widget - android

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.

Related

Activities overlapping

I am new to writing Android apps, I have been using the internet and Android Studio to create an app for my club as a bit of fun and learn along the way. I have been watching videos, using tutorials and walkthroughs and I am getting to learn the basics.
However, I have got stuck. I used a drawer template from Android Studio and added the activities I needed and buttons on the main screen to the activities and they all worked fine, no overlapping. When I tried to link the drawer icons to the activities, rather than use the buttons on the main screen, they work, but the app (visually) puts the next activities content on top of the one before.
I cant find anything on the internet except something called backstacking, but that is described when the back arrow is used, my problem is to do with selecting an activity from the drawer menu. I have attached a picture to show what I mean. It gets worse the more menu items that are selected.
If anyone could help, it would be great!
If you are using XML root layout as a constraint layout maybe your constraints are missing. If you are using constraint layout set both top/bottom and left/right constraint.
If your constraints only top for example it is look good on desing but in device that dont know where to positioning left or right and automatically positioning 0 point to top.
When you click one any one menu item put the visibility of other images as gone like
visibility(View.GONE);
and the one selected to be visible

An alternative to a list of SlidingDrawers

Hi I am developing an application that needs to display list of items. Clicking (or Tapping) on an item should display a description text of the item right below the item. I am talking about something like a vertical accordion.
I want them dynamically created (created in code rather than the XML). That part was completed with ease. I inflated multiple SlidingDrawer in a LinearLayout to accomplish it.
But the problem is only one SlidingDrawer is displayed in the activity. This was accomplished by giving fixed heights to SlidingDrawer. This approach will not hold as I mentioned above that the list of items is dynamically generated and also the area in the activity where the description of the item must come remains blank.
I am now looking for alternative views for accomplishing this. As I am a beginner in Android Development I cant find any that will work in android versions 2.3 and later.
You can always take a look at the SlidingMenu. The project can be found on GitHub. I guess you need to modify the behaviour a bit.

Implementing ListView in home screen widget

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.

How to Have multiple buttons inside Android SlidingDrawer Control

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.

Android TitleBar / NavBar?

I am not sure what the proper term is, but I am trying to add a "TitleBar" to the top of one of the windows in my App. Much like the Contacts App, I have several Tabs along the top of the screen. When you select an item from the list, it loads the next Activity, but that Activity no longer has the Tabs at the top of the screen.
I don't know if it is called a TitleBar or what. The Contacts App has this TitleBar along the top of the screen when you select a person from the list of Contacts.
I am trying to mimick the Grey Bar that says "George Washington"
The Contacts app is open source (as are most of the core Android system apps). I suggest checking it out and looking at the layout you want to emulate. In general, poking around a lot of that code is a good idea to get a handle on some best practices, or just to borrow a few tricks.
In this particular case, they're using a custom View called ContactHeaderWidget, which is actually a FrameLayout wrapping a TextView and Checkbox (styled to look like a star), along with the photo view (which has some special behavior to bind with the multiple contact source data on click and so on).
If you just want the look and not the functionality, though, just adding a LinearLayout with a GradientDrawable background containing an ImageView, a TextView, and a Checkbox styled as a star to your activity's layout should get you there a lot more easily without requiring custom widgets.

Categories

Resources