Custom fonts for home screen widget TextView in android - android

the issue I face seems to have no solution and to be downright impossible to rectify, but I thought to ask here just in case I am missing something.
I need to display some text in an android widget using a non-system, non-standard font from assets folder.
Unfortunately, android does not allow extended view definitions in home screen widgets. Nor I can invoke a corresponding API method (setTypeface) from within the widget.
Does anyone know if there's any other alternative way to accomplish this?
(It seems quite natural to be able to customise text view appearance not only in the app but in widgets too, but it turns out to be impossible).
I'd appreciate any help on this.
Thank you...

Have you seen this link yet?
What is needed is to render the font onto a canvas, and then pass it
on to a bitmap and assign that to an imageview.
How to use a custom typeface in a widget?
By the way, you've asked 18 questions and have not accepted a single answer. I suggest you start accepting some or people will be less inclined to help you.

Related

EditText-like custom view creation from the scratch (standard view)

I want to create my customized own controls apart from standard Android views/widgets including View, ScrollBar, TextView, EditText, ...
And already completed others but not TextView/EditText yet.
The two controls interact with soft-keyboard on focus or not. Plus, you can type/edit the text of the control by the keyboard. More challenging part is about controlling the caret. These problems happen because the control inherits View, not TextView/EditText.
You may ask why I chose such difficult way, not using standard ones and customize only some part of them?
That's because of one fatal problem that standard TextView/EditText cannot support large files(a few MB files) and are lagging with them. Additionally, some of the important member functions are private, not protected or public. So we cannot customize fully them as we want.
That's why I created one customized text viewer/editor that supports large files (even over 100 MB). Viewer feature already has been implemented and works well.
Now the editor feature is remaining and it's the reason why I'm here to request your help.
Please let me know what's the best solution and I'd appreciate if you can provide with some sample codes.
Thanks
P.S. This is what I've done so far.
screenshot
apk

How to use less drawable resources as possible?

I'm trying to make a kind of quiz-app relative to the music field where I keep on showing random images and the user takes the answers. For each answer I check in a database whether it is right or not. You can see some examples of what I mean here and here. The problem is that I should put in the Android Project a great number of images, which I suppose is not good. So I'm wondering if there is another way for doing that, maybe using sample-images for each element (a single note, a single sharp, the treble clef etc.) and fixing them toghether in some way in order to "build" the final image.. I really don't know. And also, is there a way to verify the answers without internet connection? Thanks in advance.
You can make a CustomView or views http://developer.android.com/training/custom-views/index.html and have it draw differently, depending on exactly what you're trying to convey. You could use a background as well as images, and draw the lines.
Adding custom View and ImageView to a single Layout explains how to include images in a CustomView .

Make ImageView large when tapped - Android

I am learning android and want to implement the following scenario and I hope I'll get a good advice to get started.
In the following screen, there are some clickable buttons that represent the sports
[FindSports][1]
and when the user taps on any one of the icon/image it should become a little bit big from other so it stands out from other icons ( it should look like this image)
[Choosen Sport][2]
Any help is much appreciated :)
PS: sorry for my bad English and if it is already answered.
All views have a setScaleX() and setScaleY() method that you can use to change the size of the view. You probably want to call those methods in an onClickListener

Android SeekBar within a homescreen Widget

I am looking to find a way to add a SeekBar to a homescreen widget. After reading this post on StackOverflow, I found that SeekBar's are not supported within a RemoteView, because it is a descendant of a ProgressBar. (Descendants of the accepted widgets are not supported)
Though, in my project, I am using Lars Werkman's HoloColorPicker found here. If you notice in the src, his OpacityBar (which is essentially a SeekBar) extends a View. Since all the accepted widgets (here) are descendants of View, I would think this would work. But alas, upon trying to load the homescreen widget with the OpacityBar, it shows up with the "Problem loading widget" response.
Does anyone know why this doesn't work? And know how to make it work?
Or does anyone know how to get a working SeekBar within a homescreen widget?
Thank you!
Since all the accepted widgets (here) are descendants of View, I would think this would work
I have no idea why you conclude that, as it it is a logical fallacy. According to your logic, since negative numbers are types of number, all numbers are negative.
Does anyone know why this doesn't work?
Because you cannot use custom Views, or anything else not supported by RemoteViews, in an app widget.
And know how to make it work? Or does anyone know how to get a working SeekBar within a homescreen widget?
Write your own home screen, and implement whatever you are trying to do with the SeekBar in that custom home screen.

Using a Widget in Activity

it's me again :-)
Is there a way to use a widget (for home screen) in my own activites?
i think the homescreen is made with java, too?!
i do not want to change thinks in the widget, i still want to display them.
Regards
FLy
If you are looking to "re-use" a widget's layout and may be its base code, that is possible. I don't think it will be a good idea [or possible] to display a widget as an activity.
There are a lot of limitations in the number of view elements that can be used inside a widget. And again the way you will update a widget [RemoteViews] is actually very different from that of an Activity.
So in short, the answer would be a "NO".
Edit: This question has also been asked and answered a lot of times: difference between view and widget

Categories

Resources