Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6614115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:17:59+00:00 2026-05-25T20:17:59+00:00

I just created class VibratingTextView . I intend to create a whole library of

  • 0

I just created class VibratingTextView. I intend to create a whole library of widgets so I want to do it the right way.

The xml for this View:

<sherif.android.textview.VibratingTextView  
    android:id="@+id/textView2"  
    android:layout_width="wrap_content"  
    android:textAppearance="?android:attr/textAppearanceLarge"  
    android:layout_height="wrap_content"  
    android:orientation="horizontal"  
    android:text="outToRight" >  
</sherif.android.textview.VibratingTextView> 

Notice it has android:orientation and android:text. It accepts the attributes of a TextView and of a LinearLayout. The class itself extends LinearLayout.

My problem is in the xml editor of eclipse. When the user types android:, eclipse’s intellisense gives the user the options available in this namespace.

In my case, it is giving the attributes of LinearLayout so, for example, Text and TextSize do not appear.

Is there a way to make them appear (using the android namespace)?

If not, should I create my own namespace with attributes that I define? or is there a way to import the android’s attributes and make them in sherif’s attributes?

Keep in mind that I am creating a TextView in the constructor of my class using the attributes passed. It is working fine and all the attributes for the TextView are being set correctly.

Since I will create many other widgets, I might need my own namespace but what is the best practice? For example, I want to create alwaysVibrate attribute. It will be something like sherif:alwaysVibrate="true". I want my library to be includable and eclipse to show the attributes of my namespace: I use the usual way using attr.xml?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T20:17:59+00:00Added an answer on May 25, 2026 at 8:17 pm

    I recently faced the exact same problem. Here are my custom attribute declarations in attrs.xml

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <declare-styleable name="NumberPicker">
            <attr name="rangeStart" format="integer|reference" />
            <attr name="rangeEnd" format="integer|reference" />
            <attr name="speed" format="integer|reference" />
            <attr name="current" format="integer|reference" />
            <attr name="android:orientation" />
        </declare-styleable>
    </resources>
    

    You can reuse the android attributes but you can’t teach them to suggest different values. In fact you can’t even teach eclipse to suggest your custom attribute definitions (at least at this date of post, I would love to see that feature in future).

    Everything else you would want to know about defining custom attributes is in the question:
    Declaring a custom android UI element using XML.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've created a custom view class and right now just want to draw an
i just created my own library on this folder (application/library) and following all steps
I just created this new class : //------------------------------------------------------------------------------ #ifndef MULTITHREADEDVECTOR_H #define MULTITHREADEDVECTOR_H //------------------------------------------------------------------------------ #include
i just create reading file feature. In general, what kind PHP class that usually
Just created an acc on SO to ask this :) Assuming this simplified example:
I just created a project so my Solution Explorer looks like this: (source: kalleload.net
I just created a user control. This control also makes use of my static
I just created a new Xcode project. In the AppControl class Header file I
Using the standard VS IDE, is there a fast way to create class properties
I'm developing an iPhone application and I've just created this method (it's in a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.