Calling a View in XML (R.layout.main)

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Calling a View in XML (R.layout.main)

Postby xspotlivin » Sat Mar 14, 2009 2:27 am

I have created a ClockView that extends view. I'd like to call this view in the main.xml file. My activity currently set's the content view to this ClockView (setContentView(this.clockView)). However, I'd like to put it in the main.xml file and say "setContentView(R.layout.main)". This is because I want some buttons and a textview. Here is what I have currently done (my package is nmm.android.adherenceclock):

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2.  
  3. <AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
  4.  
  5.    android:orientation="horizontal"
  6.  
  7.    android:layout_width="fill_parent"
  8.  
  9.    android:layout_height="fill_parent"
  10.  
  11.    >
  12.  
  13. <TextView  
  14.  
  15.    android:layout_width="fill_parent"
  16.  
  17.    android:layout_height="wrap_content"
  18.  
  19.    android:text="@string/adherenceclock"
  20.  
  21.    />
  22.  
  23. <nmm.android.adherenceclock.ClockView
  24.  
  25.         android:layout_width="fill_parent"
  26.  
  27.         android:layout_height="fill_parent"
  28.  
  29.         />
  30.  
  31. <ImageButton
  32.  
  33.         android:id="@+id/checkbox"
  34.  
  35.         android:src="@drawable/box_check"
  36.  
  37.         android:layout_width="wrap_content"
  38.  
  39.         android:layout_height="wrap_content"
  40.  
  41.         android:layout_x="240px"
  42.  
  43.         android:layout_y="160px"
  44.  
  45.         />
  46.  
  47. </AbsoluteLayout>
Parsed in 0.003 seconds, using GeSHi 1.0.8.4


What's wrong? Just puting ClockView by itself doesn't work either. Suggestions?
xspotlivin
Junior Developer
Junior Developer
 
Posts: 23
Joined: Thu Feb 26, 2009 8:15 am
Location: Cambridge, MA

Top

Postby xspotlivin » Sat Mar 14, 2009 2:29 am

FYI, I'm getting an java.lang.ClassNotFoundException.
xspotlivin
Junior Developer
Junior Developer
 
Posts: 23
Joined: Thu Feb 26, 2009 8:15 am
Location: Cambridge, MA

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 5 guests