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 3216046
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:14:55+00:00 2026-05-17T15:14:55+00:00

I have a ViewFlipper defined that contains 3 views… <?xml version=1.0 encoding=utf-8?> <ViewFlipper xmlns:android=http://schemas.android.com/apk/res/android

  • 0

I have a ViewFlipper defined that contains 3 views…

<?xml version="1.0" encoding="utf-8"?>
<ViewFlipper xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/flipper" android:layout_width="fill_parent"
android:layout_height="fill_parent">
  <include android:id="@+id/first" layout="@layout/first_view" />
  <include android:id="@+id/second" layout="@layout/second_view" />
  <include android:id="@+id/third" layout="@layout/third_view" />
</ViewFlipper>

I also have a custom View defined within my Activity…

private class CompassView extends View { 
  @Override 
  protected void onDraw(Canvas canvas) {
  ...
  }
}

Some how, I need these linked together so that the ‘third_view’ defined in the XML layout file needs to be a CompassView, or have a CompassView added to it.

What I can do is drop the ‘third_view’ from the layout and then add in the CompassView manually..

viewFlipper = (ViewFlipper)findViewById(R.id.flipper);
viewFlipper.addView(new CompassView(this));

But then I lose the ability to define other view controls within the layout file.

Can I add CompassView to ‘third_view’ declaratively?

  • 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-17T15:14:56+00:00Added an answer on May 17, 2026 at 3:14 pm

    If the question is how to add a custom view in an Android XML layout file, try this:

    <com.example.CustomView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content">
    </com.example.CustomView>
    

    The open and close tags should just be the fully qualified class of your custom view.

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

Sidebar

Related Questions

I have a ViewFlipper that presents 3 different views. Is it possible to have
I have an Activity that contains a FrameLayout and two views. The first is
I have a ViewFlipper which contains a few linear layouts. I need to allow
I would like to switch to certain views in a ViewFlipper. Currently, I have
I have a ViewFlipper implementation that needs to be improved. This ViewFlipper has three
I have a ScrolLView that wraps a ViewFlipper. The content in the ViewFlipper is
This is maddening. I have the following XML layout: <FrameLayout android:layout_width=fill_parent android:layout_height=wrap_content android:background=@drawable/shadow android:focusable=true
I have different screen to work in an android application. I'm using ViewFlipper for
I have a ViewFlipper that is transitioned between each view, I want to draw
Ok I have a ViewFlipper with three LinearLayouts nested inside it. It defaults to

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.