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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:09:53+00:00 2026-06-04T12:09:53+00:00

In my applications, I often rely on custom build views, such as in the

  • 0

In my applications, I often rely on custom build views, such as in the following example.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" 
android:background="@color/light_grey"
android:layout_height="match_parent" 
android:layout_width="fill_parent" >

<TextView 
 style="@style/CardTitle" 
 android:id="@+id/card_title"
 android:layout_height="wrap_content" 
 android:layout_width="fill_parent"      
 />  

<com.whiterabbit.cards.ui.AspectRatioImageView
    android:id="@+id/card_picture"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:adjustViewBounds="true"
    android:layout_marginLeft="30dip"
    android:layout_marginRight="30dip"       
    android:src="@drawable/boss"
    />



<ListView 
    android:id="@+id/card_properties" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"

/>

The problem is, I don’t know how if it will be displayed correctly until I run it on a real device or on the emulator. Moreover, if I found something wrong I would have to perform changes on it and deploy the app again to see if the changes worked as you expected.

This can be a long and boring process, especially if the application requires some interaction to get to the activity you want to check.

Using the visual editor doesn’t work as it cannot load the custom view.

Is there another way to check how views are displayed without running across the whole application?

  • 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-04T12:09:55+00:00Added an answer on June 4, 2026 at 12:09 pm

    You can do this in your Custom View:

    if(!isInEditMode()){
       // Your custom code that is not letting the Visual Editor draw properly
       // i.e. thread spawning or other things in the constructor
    }
    

    http://developer.android.com/reference/android/view/View.html#isInEditMode()

    This allows you to hide code from the ADT Plugin XML Viewer and hopefully display you a layout!

    View.isInEditMode()

    Indicates whether this View is currently in edit mode. A View is
    usually in edit mode when displayed within a developer tool. For
    instance, if this View is being drawn by a visual user interface
    builder, this method should return true. Subclasses should check the
    return value of this method to provide different behaviors if their
    normal behavior might interfere with the host environment. For
    instance: the class spawns a thread in its constructor, the drawing
    code relies on device-specific features, etc. This method is usually
    checked in the drawing code of custom widgets.

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

Sidebar

Related Questions

I've observed a lot of stack-introspective code in applications, which often implicitly rely on
In my applications, I often have to use relative paths. For example, when I
For one of my applications, the following function has to be called very often.
In my Windows Forms applications I often put the controls' text data (form title,
In the many Python applications I've created, I often create simple modules containing nothing
I work on applications developed in C#/.NET with Visual Studio. Very often ReSharper, in
At my company, we develop our ASP.NET applications as websites and often just work
I like the python-send-buffer command, however I very often use Python embedded in applications,
Often times applications will need some database code tables (aka reference tables or domain
I often write .net applications that only support one instance. Formerly I used .net-remoting

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.