I have an edittext in my application that will show the cursor correctly in Froyo or Gingerbread, however in later sdks the cursor is invisible. I have found online the solution is to set the android:textCursorDrawable="#null" so that the edittext will use the font color for the cursor. However, since my minsdkversion is 8, I do not have access to that property.
Is their either a way to selectively add a property based on the sdk you are on? Or possibly a way to work around this so that I can have visible cursors on both older and newer sdk versions?
I don't know your current setup, but one way to use that property is to use different layouts folders based on various android versions. android:textCursorDrawable is a property introduced in API 12 so you could have a layout folder like layout-v12 which will be used where the API is 12 or greater. In the layouts from this folder the use of the property is valid.
For lower versions, Froyo and Gingerbread, you don't have any problems so you would use a default folder, layout. In the end you'll have two layouts folder(containing the same layout files):
layout // don't need the property
layout-v12 // use the property
That leaves out API 11, I don't know if this is a deal breaker for you.
Try setting your targetSdkVersion to API level 13 or higher to gain access to the android:textCursorDrawable property
If you not has a cursor I guess the input is simple and say you only can enter new chars at end of the text?
I think you can use a TextView and to this add you own KeyListener?
But in this case you will has problem with the virtual keyboard not is show, see some of this links:
Forcing the Soft Keyboard open
android force keyboard visible
or create you own keyboard if the rang of valid keys is very limit as only digits.
Related
I am really new to android so pardon me. Why is there a strike-through
for example (fill_parent)
in some android variables and not others
The strikeout shows deprecated methods or attributes (assuming you are using Android Studio / IntelliJ). In your case FILL_PARENT (LayoutParams?) is deprecated for a really long time (API Level 8). It is now called MATCH_PARENT (see https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html). Hovering the variable should show you a tooltip with more information on the deprecation and when it was deprecated. Just make sure you don't use those deprecated elements.
I try what simon tell to do for change direction but it's doesn't working.
It's seems that for hundredth of a second it's work but when Action bar add the action buttons it's put the buttons at left instead at right.
What can be the problem? it's seems that somewhere in nmy code had line that tell freamwork to do otherwise?
The RTL value (true or false) is included in the flags in getApplicationInfo.flags.
As a long shot - is it possible that you are somehow changing the value?
The ability to set RTL was added in Android 4.2 if you are supporting this OS level or higher, this will be easier for you to accomplish.
Proof it is 4.2+: https://groups.google.com/forum/#!topic/actionbarsherlock/-npidM2Eo0w
Google post outlining how to change to RTL: https://plus.google.com/+AndroidDevelopers/posts/HuHNSb8V7s8
Otherwise, I would reference the SO question already pointed to in another comment if you are supporting an OS level older than 4.2: How to handle RTL languages on pre 4.2 versions of Android?
I have a LinearLayout and on some devices all the views are reversed.
The Good Version:
[b1] [b2] [b3]
On some devices:
[b3] [b2] [b1]
Why does that happen and how can I fix it?
If you're targeting and testing on API level >=17 (i.e. Android 4.2) this might be caused by RTL support, as described here.
If you don't want this, you can either change android:layoutDirection for each particular view (and since the default is inherit, the root view should suffice) or you can disable it for the whole application by setting android:supportsRtl="false" in the AndroidManifest.xml file.
Or, you could also target an API level < 17, since it will then be disabled for compatibility (but this would lock you out of certain APIs).
I am developing an app and using spinners(Using eclipse). I am using Fragments and also using support-v4 library. I have set MinSdkVersion to 8 for backword compativility.
The problem is, in XML, when I drag and drop spinners, it is showing me the old UI for spinner which was there in API 8 or 9 and designing UI is becoming almost impossible.
(However in my Phone, it is showing the latest UI for Spinner, but I can't design it well in XML - eclipse.)
Also attaching the URL of snapshot (as I don't have enough reputation to post and image) of the XML view within the eclipse.
Link to Image : http://tinyurl.com/ErrorInUI
I tried changing MinSdkVersion to 17. It didn't work.
In your XML Graphical editor, you can change the appearance by selecting the rendering style in the API Level dropdown (there's the current API Level number with an arrow, near the little green robot):
I am working on an application that will work on Android WebView. I enabled the selection and copy for this view. In some devices that support Arabic, When I paste the copied text from WebView in any EditText view, It shows me the reserve text. but In some cases it shows me the correct form.
Could any one please help me to show in correct form in all devices ? :-/
I have red all threads that depend on supporting Arabic and Farsi Text, but I can not reach my purpose.
Thanks in advance :)
You can pass your copied text to FarsiLibrary. It will analyses your text letters and justify them according to their possible 4 states (Initial, Middle, End, Isolated) :
Initial like 'ن' in 'نازک'
Middle like 'ن' in 'هنر'
End like 'ن' in 'وطن'
Isolated like 'ن' in 'ایران'
Android has Added support for RTL in Native widgets(i.e TextView , EditText) . so if u run the app onward 4.2 u will get RTL feature automatically ,
http://android-developers.blogspot.com.es/2013/03/native-rtl-support-in-android-42.html
You can create different versions of the layouts for different API versions.
As you can read here: http://developer.android.com/guide/topics/resources/providing-resources.html you can have say the normal folder (/res/layout/) with the layout for old devices and then another one for the ones that support it: /res/layout-11/
The layout inside layout-v11 will only be applied on devices with android 3.0 and over.