i have extended view into a ScrollImageView. Then i put that into the xml:
In main.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:orientation="vertical">
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content" android:text="@string/hello" />
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content" android:id="@+id/my_xml" />
<com.Android.Maps03.ScrollImageView
android:id="@+id/BaseView" android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</RelativeLayout>
Then i want to work with that in the main activity like this:
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
ScrollImageView sIV = (ScrollImageView)findViewById(R.id.BaseView);
Bitmap markerImage = BitmapFactory.decodeResource(this.getResources(), R.drawable.mapbase );
sIV.setImage(markerImage);
When i run the app, the ScrollImage doesnt Appear.
The constructor of the clase (ScrollImageView) is this:
public ScrollImageView(Context context, AttributeSet attributeSet) {
super(context);
initScrollImag开发者_运维技巧eView(context);
private void initScrollImageView(Context context) {
mDisplay = ((WindowManager)context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
mPadding = DEFAULT_PADDING;
}
do you have and idea?
Thanks.
Comment #1 Yes, i forget that, but i have the same problem.
Comment #2 No, im closing all the layout with the second />, not closing twice
Comment #3 This is the new logcat, i think this is the most remarkable entries.
Plz Help!
You aren't calling setContentView in your Activity onCreate
精彩评论