Mark,

This is just how it works. You can only use a limited set of view classes in a widget. Application-provided subclasses are not supported.

http://developer.android.com/guide/topics/appwidgets/index.html#CreatingLayout

-- Kostya

26.04.2011 13:44, MarkG123 пишет:
I'm having a nightmare trying to get this to work.  Is it even
possible?

I have a very simple widget that works just fine with a TextView,
however when I change it to use a subclassed TextView and change the
layout XML to reference it, nothing works anymore..

Even a subclassed TextView that does nothing does not work.

Subclassed TextView:

package com.me.myapp;
  import android.content.Context;
import android.util.AttributeSet;
import android.widget.TextView;

public class MGTextView extends TextView {

     public MGTextView(Context context) {
         this(context, null);
     }

     public MGTextView(Context context, AttributeSet attrs) {
         this(context, attrs, 0);
     }

     public MGTextView(Context context, AttributeSet attrs, int
defStyle) {
         super(context, attrs, defStyle);
     }
}

Layout:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
      android:id="@+id/LinearLayout01"
      android:layout_height="72dp"
      android:background="@drawable/background"
      android:layout_width="294dp"
      android:orientation="horizontal">

      <com.me.myapp.MGTextView android:id="@+id/widget_textview"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:gravity="center_vertical|center_horizontal"
          android:textColor="@android:color/black"
          android:text="Loading..."
           />
  </LinearLayout>



--
Kostya Vasilyev -- http://kmansoft.wordpress.com

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to