Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion custom attributes in library projects
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Adam Tybor  
View profile  
 More options Feb 8 2011, 9:01 am
From: Adam Tybor <adam.ty...@gmail.com>
Date: Tue, 8 Feb 2011 06:01:27 -0800 (PST)
Local: Tues, Feb 8 2011 9:01 am
Subject: Re: custom attributes in library projects

Its not great but what I have been doing is using includes and redefining
the include in the application project.  You can still define the attribute
in the library project, you can use simple framelayouts or whatever to
define a fake placeholder layout in the library project, then in the
application project define the real view.  When compiling the real view in
the application project it will override the library project.  This allows
the code to compile with the R.syles stuff in the lirbary, yet still have
the views work too.

Best of luck, its kludgy but workable.
Adam

<< Library >>
res/values/attrs.xml:
<resources>
        <declare-styleable name="MyWidget">
                <attr name="customValue" format="integer"/>
        </declare-styleable>
</resources>

res/layout/myWidget.xml
<TextView
    android:id="@+id/my_widget"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:text="Replace Me"/>

res/layout/main.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
    <include layout="@layout/myWidget.xml" android:id="@+id/my_widget" />
</LinearLayout>

<< App Project>>
res/layout/myWidget.xml
<com.mycompany.test.lib.MyWidget xmlns:android="
http://schemas.android.com/apk/res/android"
        xmlns:my="http://schemas.android.com/apk/res/
    android:id="@+id/my_widget"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    my:customValue="324"/>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.