Android :: Auto-centering And Auto-clipping TextView Background
Apr 4, 2010
Is there a way to tell Android to do the following when setting the background image for a TextView?
1. Scale the image so that it's just large enough to fill the the entire viewing area without any black borders, while still maintaining its aspect ratio. This might require clipping once the image is actually displayed, but that's OK (read on).
2. Then, center the image in the viewing area, both horizontally and vertically.
3. Finally, clip the image to the size of the viewing area, without any further rescaling.
I'm guessing that this kind of image processing is not automatically done via any of Android's facilities, and that I'll have to do it myself. If this is a correct assumption, could someone point me to some documentation or some examples which could explain how I can accomplish this? I'm guessing that I'll have to subclass my TextView and implement my own onDraw() method, but could someone confirm or deny that assumption?
View 3 Replies
Aug 24, 2013
I'm trying to limit my mobile data usage with out jumping through hoops.
I'm looking for a widget, that with one click of a button, it can restrict background data, disable auto-sync and enable mobile data, and when pressed again, enable WiFi, disable background restriction and enable auto-sync.
This function, no matter how trivial, would save time and effort.
Is there anything like this out there? Would something like this require root?
Galaxy Nexus
View 5 Replies
View Related
Oct 14, 2009
I have a TextView in my android application that has a set width on it. It's currently got a gravity of "center_horitonzal" and a set textSize (9sp). I pull values to put on this label from a sqlite database, and some of the values are too large to fit in the TextView at the current textSize.
Is there a way to detect that the text inside a TextView is going to be clipped? I'd like to detect this, and lower the font until it fits. There is a nice property in the iPhone UILabel that handles this called "adjustToFit" (which also has a minimum font size), and I'm basically trying to emulate that.
Here's an example of the TextView that I'm working with:
CODE:........................
View 2 Replies
View Related
Jul 20, 2010
I'm looking for an alarm clock app with one very specific feature - allow me to set the alarm tone to automatically stop after X seconds, then start again at the next snooze interval, and play for another X seconds.
Sure it seems every alarm app out there allows me to set Snooze intervals and stuff, but with my waking up habit, I don't like to physically have to touch the phone to get it to shut up until the next snooze interval. I like to lay in bed and let the alarm go for like 3-4 snooze intervals before I finally wake up.
I've tried Alarm Clock PlusV2, Alarm Clock Xtreme, Quick Alarm. None of them seem to have this.
View 2 Replies
View Related
Dec 7, 2009
I installed it on my Droid and when I open the list and long press on an app it gives me the option to Auto-Kill. I assume this means I won't have to kill this app any longer so I select this option but I find that I keep having to kill the same apps over and over again. What's the point of Auto-Kill or what am I doing wrong? There are lots of programs (most I didn't even install) that run all the time and I'm having battery issues so I don't have battery to waste on programs I'm not using and will probably never use.
View 22 Replies
View Related
May 7, 2010
I have a Motorola Milestone running Android 2.1.Is there a widget which turns "background data" ("Settings -> account & sync -> background data") on/off? I know there are several widgets which turn auto sync on off (e.g. the power control widget) and disable data connections altogether (apndroid, quick settings, etc), but that's not what I need. I searched the market, google and this forum but couldn't find anything.The only workaround I found was to create a shortcut to "account & sync" using "any cut". Not a widget, but close enough.Is there a widget, or a better way to do this?
View 3 Replies
View Related
Apr 20, 2009
I want to develop an application that disable the Background Data (new feature in Android 1.5) and Auto Sync and then enable GPRS/EDGE connection and vice versa.
I figured out how to enable/disable GPRS/EDGE by changing the APN settings. (weird solution. However; Android developers couldn't think a user may want to disable GPRS/EDGE) But, I couldn't find a way to enable/disable Auto Sync and Background data.
I investigated the Android code and as I understood, the Sync operation is an intend. So, I wanted to reach with putExtra to the intend and trigger the enabling/disabling. But; I couldn't find the correct keyword.
View 2 Replies
View Related
Dec 9, 2009
Are these the same? I have searched the forum, and can't seem to find the answer. I don't find any "auto brightness" setting in the settings menu on the Hero. I have auto backlight unchecked. What exactly does this do? Is this the screen dimming? Sorry, I am confused. Uh oh! Must be a senior moment!
While I am showing off photos I have on my phone, the screen dims...how do I keep this from happening?
Also, relating to photos..when I go to "Albums", I have 4 folders listed...Camera Shots, All Photos, etc. When I take a pictures with the phone camera, they seems to be in both folders. Why?
View 10 Replies
View Related
Jun 14, 2010
if i turn them both off will my email update every hour like i have it set? Or do i have to turn on one of them? I also noticed that in order to go to the market place i have to have background data on, why is this even though i can go onto the internet with both of the settings off?
View 5 Replies
View Related
Oct 16, 2010
My wife and I have been having the same problem. We keep the auto-brightness option checked, but every so often we find that it goes back to manual mode--and it always reverts the phone back to full brightness setting. Any ideas why this would happen?
View 4 Replies
View Related
Aug 6, 2010
If I set "background data" to off and leave on "auto-sync" and sync for my gmail account on will I still receive emails and text messages in real time?
View 1 Replies
View Related
Nov 24, 2010
Android:layout_gravity="center" doesn't seem to work the same in a RelativeLayout as it does in a linear one - I would just like both an ImageButton and a TextView to be centered in a relative layout - is there a basic xml code for this?
View 1 Replies
View Related
Sep 11, 2010
I've set my Friendstream to update every hour, and this was working fine for weeks. Recently, although it's still refreshing the sync time icon at the bottom every hour, it's not actually updating the widget with the new information. It takes a manual sync for it to refresh. Auto-sync is on, background data is enabled.
View 4 Replies
View Related
Oct 2, 2010
I have a background image about 100 x 100 that I want to center in an Android app. Is there a way to do this?
I'm thinking it would greatly help with orientation changes for simple apps.
View 1 Replies
View Related
Jun 11, 2010
I was wondering what does this change and how (other than better battery life...supposedly) will this affect my phone? Will it continue to work the same as before? or will it only work in sprint network with no roaming or what?
View 41 Replies
View Related
Sep 26, 2010
So one of the cool things about Froyo is being able to check off Enable Automatic Update for market apps. So i have that checked off for like 80+% of my 80+ apps (that took a while to do let me tell you). Now i have had three apps have updates available since i checked off the box, yet they never actually automatically updated. I waited, hours, still never updated. Is there a setting i need to modify? Do i need to tell it what time of day to do it? Anyone else noticing this? I only really want it in apps that i don't care about reading the new features. But it is annoying that i have it enabled and it does nothing.
View 1 Replies
View Related
Aug 18, 2010
If "always on mobile data" is disabled, will this have any affect on programs that are set to auto sync with back ground data enabled(Face book, twitter etc)? I'm trying to work it out but lots of people say different things?
View 13 Replies
View Related
Sep 28, 2013
is there an auto hide home screen icons app like Auto hide desktop icons for PC? I found some but its not like i want. I want that the icons should stay hidden until i tap on the home screen.
View 2 Replies
View Related
Apr 28, 2010
I have a TextView that I created in the main.xml. In my app.java I am dynamically positioning that TextView based on where the user taps the screen. The problem I am having is that when I call myTextView.setPadding(100,100,0,0), it moves the actual Text of the TextView, but does not move the Colored Background of the TextView.
View 3 Replies
View Related
Jun 7, 2010
Is there an App out there that will automatically shut the phone off and turn it on and a specific time?
View 5 Replies
View Related
Nov 12, 2010
I have a ListView with a lot of "rows". In each row, i have one TextView with a background image. When i scroll, the images of the rows mixes... they jump to another row with the scroll.
In have tried android: scrollingCache="false" and android:cacheColorHint="#00000000" but nothing.
The images are loaded dinamically.
Part of my layout:
CODE:.........................
And part of my code:
CODE:............
"avatars" is a cache of Drawables. any idea?
View 1 Replies
View Related
Aug 28, 2010
I'm attempting to change the background color of an Android TextView widget when the user touches it. I've created a selector for that purpose, which is stored in res/color/selector.xml and roughly looks like that:
CODE:................
The clickable attribute of the TextView is "true", in case that's of interest.
When I assign this selector to a TextView as android:background="@color/selector",
I'm getting the following exception at runtime: ERROR/AndroidRuntime(13130): Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #6: <item> tag requires a 'drawable' attribute or child tag defining a drawable
When I change the attribute to drawable, it works, but the result is looking completely wrong because the IDs appear to be interpreted as image references instead of color references (as the "drawable" suggests).
What confuses me is that I can set a color reference, e.g. "@color/black", as the background attribute directly. This is working as expected. Using selectors doesn't work.
I can also use the selector as the textColor without problems.
What's the correct way to apply a background-color-selector to a TextView in Android?
View 2 Replies
View Related
Jul 21, 2010
I am having a friend from another country, so i'm using a Websms app with fishtext connector. I would like to know if there exists any app that automaticaly turns internet connection (wifi or mobile connection) on whenever a certain app is active and then turns off when screen is off? Or simply an app that turns wifi/mobile network on/off when the screen is on/off ? on my oold phone it turned on internet connection itself when sending data, then turns off when done! so simple and smart...
View 3 Replies
View Related
Nov 9, 2010
When I plug my phone in, it auto-mounts and its very annoying, anyone know what app is doing this? I keep finding apps that do it which I don't have.
View 4 Replies
View Related
Nov 23, 2009
Has a way been added to the Android 2.0 SDK to disable auto dimming on the Motorola Droid?
View 7 Replies
View Related
May 18, 2010
I know there are apps that can auto respond to all SMS's received with a predetermined SMS. is anyone aware of an app that lets you select certain people and not just everyone in the contact list?
View 1 Replies
View Related
Aug 28, 2010
How to I set the time to get mail using K-9. It seems that the Mail app (HTC Desire) is getting new mail but not K-9.
View 2 Replies
View Related
May 27, 2009
I want to add an auto update function to an app. This app can download a new version of itself, i.e., a new apk file. After finishing downloading this apk file, how to let the app update?
I'm going to try this by using PackageManager.installPackage(), but failed. The system said no one has the permission to install a package, even I had added "<uses-permission android:name="android.permission.INSTALL_PACKAGES" />" to the manifest.xml.
View 2 Replies
View Related
Feb 17, 2010
I have a situation where I am using a TextView with an image and would like to set a background on just the text part. When I use android:background it sets the background behind both the text and the image. Is there a way to have it just put the background behind the text without me having to tear apart my layout and use a separate ImageView with the TextView?
View 5 Replies
View Related
Oct 10, 2010
I have an XMl file like below which I will use to set background for Textview:
row.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
The above Xml I will set as background for TextView in main.xml as below:
main.xml
<TextView
android:id="@+id/rowtext3"
android:text="Availablity"
android:layout_height="25px"
android:layout_width="60px"
android:textSize="10px"
android:textStyle="bold"
android:textColor="@color/black"
android:gravity="center"
android:background="@drawable/row"/>
But I want this to do from code rather than Xml.I have done everything that I have done in Xml like font,width,Height,font dynamically through code , but not able to set Background that I mentioned in Xml file . How can we set content of Xml file as background to textview similar to how we set background as XML in main.xml.
In the code I have done like this:
t1=new TextView(this);
t1.setText(ed1.getText());
t1.setHeight(25);
t1.setWidth(60);
t1.setTextSize(10);
But I didn't find how to set background i.e. how to set XML content as background?
View 2 Replies
View Related