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

  • Home
  • SEARCH
  • 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 7791677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T21:57:43+00:00 2026-06-01T21:57:43+00:00

Normally in an Android layout file if you want to create a custom view

  • 0

Normally in an Android layout file if you want to create a custom view you have to fully qualify the path of the class.

<com.blah.blah.blah.Widget>
    ....
</com.blah.blah.blah.Widget>

Is there anyway to import a class in the XML so you don’t have to repeat package names? Some of my package names are quite long and its just a huge pain in the butt when some layouts have many custom views.

The ability to do…

<import path="com.blah.blah.blah.MyWidget"/>

<MyWidget>
    ...
</MyWidget>

Would make my life much easier.

Obviously that import tag doesn’t currently exist but is there a way to extend the inflator to add it?

If not is there another way to do this?

  • 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-06-01T21:57:44+00:00Added an answer on June 1, 2026 at 9:57 pm

    Is there anyway to import a class in the XML so you don’t have to repeat package names?

    No, sorry.

    Obviously that import tag doesn’t currently exist but is there a way to extend the inflator to add it?

    In theory, you can set a factory on LayoutInflater, which gets control during the inflation process, and might be usable to accomplish this. However, that would only work for a LayoutInflater you use directly, not for any used by the system (e.g., setContentView(), default Adapter inflation).

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

Sidebar

Related Questions

I'm trying to create custom layout for android. It normally draws on screen, but
I have layout structure: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <com.google.ads.AdView android:layout_width="fill_parent" android:layout_height="wrap_content" ads:adSize="BANNER"
Normally I create web application projects and use code-behind, but I have a requirement
I have never seen this before. I have a simple custom view that has
I have a EditText in a layout with a white background. On Android 2.x,
I have, for the time being, a custom view with a 9-patch image as
I am very new to android development.... i have created an app and want
I'm having difficulty getting the GUI layout results I want in an Android app.
I am very new to xml codings. I normally use android's graphical layout tools
I'm trying to show a list of data in an android activity. Normally anyone

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.