mail-archives/monodroid/2011-December/008045.html

102 строки
4.1 KiB
HTML
Исходник Обычный вид История

2019-06-06 22:06:39 +03:00
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [mono-android] FindViewById keeps returning null for an included layout
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:monodroid%40lists.ximian.com?Subject=%5Bmono-android%5D%20FindViewById%20keeps%20returning%20null%20for%20an%20included%0A%09layout&In-Reply-To=">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="008050.html">
<LINK REL="Next" HREF="008051.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[mono-android] FindViewById keeps returning null for an included layout</H1>
<B>Luke Stevens</B>
<A HREF="mailto:monodroid%40lists.ximian.com?Subject=%5Bmono-android%5D%20FindViewById%20keeps%20returning%20null%20for%20an%20included%0A%09layout&In-Reply-To="
TITLE="[mono-android] FindViewById keeps returning null for an included layout">lstevens at asiweb.com
</A><BR>
<I>Thu Dec 22 18:23:49 EST 2011</I>
<P><UL>
<LI>Previous message: <A HREF="008050.html">[mono-android] Default New Project cannot run in android emulator
</A></li>
<LI>Next message: <A HREF="008051.html">[mono-android] UnsatisfiedLinkError
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#8045">[ date ]</a>
<a href="thread.html#8045">[ thread ]</a>
<a href="subject.html#8045">[ subject ]</a>
<a href="author.html#8045">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>I've been having some trouble lately accessing a layout that I'm adding to a
TableRow (and assigning an id to, because I want to re-use this layout file
multiple times) with an &lt;include&gt; in the XML. The lines looks like this:
&lt;TableRow&gt;
&lt;include android:id=&quot;@+id/sumlabel1&quot; layout=&quot;@layout/sumlabelcell&quot;/&gt;
&lt;/TableRow&gt;
The 'sumlabelcell' layout file looks like the following:
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;
&lt;merge xmlns:android=&quot;<A HREF="http://schemas.android.com/apk/res/android&quot;">http://schemas.android.com/apk/res/android&quot;</A>&gt;
&lt;RelativeLayout
android:id=&quot;@+id/sumLabelCell&quot;
android:layout_width=&quot;fill_parent&quot;
android:layout_height=&quot;fill_parent&quot;
android:background =&quot;@color/summarydarkbackground&quot;
&gt;
&lt;TextView
android:id=&quot;@+id/sumLabelText&quot;
android:layout_width=&quot;fill_parent&quot;
android:layout_height=&quot;fill_parent&quot;
android:textColor=&quot;#ffffffff&quot;
android:padding = &quot;15dp&quot;
/&gt;
&lt;/RelativeLayout&gt;
&lt;/merge&gt;
Now, when I try to access 'sumLabelCell' directly, it works fine. However,
when I try to access 'sumlabel1' with FindViewById, I always get a null
value returned. Any ideas what I could be doing wrong here? Thanks in
advance for the help!
--
View this message in context: <A HREF="http://mono-for-android.1047100.n5.nabble.com/FindViewById-keeps-returning-null-for-an-included-layout-tp5095897p5095897.html">http://mono-for-android.1047100.n5.nabble.com/FindViewById-keeps-returning-null-for-an-included-layout-tp5095897p5095897.html</A>
Sent from the Mono for Android mailing list archive at Nabble.com.
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="008050.html">[mono-android] Default New Project cannot run in android emulator
</A></li>
<LI>Next message: <A HREF="008051.html">[mono-android] UnsatisfiedLinkError
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#8045">[ date ]</a>
<a href="thread.html#8045">[ thread ]</a>
<a href="subject.html#8045">[ subject ]</a>
<a href="author.html#8045">[ author ]</a>
</LI>
</UL>
<hr>
<a href="http://lists.ximian.com/mailman/listinfo/monodroid">More information about the Monodroid
mailing list</a><br>
</body></html>