Tag: view

Android Development: How Can I Make An EditText Plain So It's Just A White Square?

As the title says, I’ve seen EditTexts where they are just plain white with no smooth corners or orange android border when you highlight it etc. Like it looks in this app: http://s1.appbrain.com/screen?id=-2631427781674403509&i=1

Bitmap from TextView (getDrawingCache) always null

I am trying to extract the bitmap associated to the displayed TextView instance, but it always returns a null value. What Am I doing wrong? Should I use textview.draw(canvas) instead? TextView textview = (TextView) findViewById(R.id.text_title); textview.setDrawingCacheEnabled(true); textview.buildDrawingCache(); Bitmap bmp = textview.getDrawingCache();

How to create a simple custom View?

I would like to create an custom View on Android. I have tried to do it as simple as possible and created an almost empty class MyView and used it in my LinearLayout but the application fails on start with “Force Close”. How can I do a simple custom View? According to Building Custom Components […]

Call to `getDrawingCache` returns null when scroll is enabled

What is missing in this code? This same code works on ICS. On API 8 the scroll appears and some content goes out of screen. How to get the drawing cache in this case? Code: TableLayout page = (TableLayout) findViewById(R.id.page); page.setDrawingCacheEnabled(true); page.buildDrawingCache(); // getDrawingCache returns null… Bitmap pageBmp = Bitmap.createBitmap(page.getDrawingCache(true)); page.destroyDrawingCache(); page.setDrawingCacheEnabled(false);

ICS Spinner (“drop-down” rather than dialog) in older Android versions

I’m trying to mimic the newer Ice Cream Sandwhich version of the spinner, where it looks more like a drop-down list rather than a pop-up dialog. See this link to get an idea of what I’m talking about. I read some posts stating to use ActionBarSherlock to get the desired effect. However, this is created […]

Android ListView Custom Adapter ImageButton

This may not be the correct approach, if there is a better way pleas tell me. I’ve created a class of Custom Adapter & in my getView method I inflate the view I want to use public View getView(int position, View convertView, ViewGroup parent) { View v = mInflater.inflate(R.layout.wherelayout, null); if (convertView != null) { […]

New view in xml(layout) file cant be created(java.lang.NoSuchFieldError: No static field tv of type I)

I have a project which uses two modules(libraries), I created some activity and its respective layout file in one of my library, I can’t seem to add new views in that layout (Textview, Imageview etc). Here is the logcat output. java.lang.NoSuchFieldError: No static field tv of type I in class Lcom/camera/sushant/opencamera/R$id; or its superclasses (declaration […]

What kind of connection exists between innerRadiusRatio and thicknessRatio from GradientDrawable class?

Let’s supposed we’ve got a ring with inner radius R2 and outer radius R1. According documentation: Inner radius of the ring expressed as a ratio of the ring’s width.For instance, if innerRadiusRatio=9, then the inner radius equals the ring’s width divided by 9 As I understand this means that innerRadiusRatio = 2*R1 / R2. About […]

Why Is Custom View not Invalidating?

Im a noob to android development and I am having problems invalidating a view. I am using this tutorial and have no issues implementing it. However, when I change the background of the view, it still responds as if the previous background is still set. In other words, I change the mask but my “touchview” […]

Providing a default style (attributes) in a custom view

Please, let me know, how can I set the default background of a custom button to null. I mean… I know I can define a “style” which set android:background to “@null”, and ask users to explicitly apply the style in their layout. For example: <style name=”MyButton” parent=”@android:style/Widget.Button”> <item name=”android:background”>@null</item> </style> and <com.xxx.widget.MyButton android:layout_width=”match_parent” android:layout_height=”wrap_content” style=”@style/MyButton” […]

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.