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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T12:17:15+00:00 2026-06-05T12:17:15+00:00

Is it possible to show pagelines in a EditText ? I mean these lines:

  • 0

Is it possible to show pagelines in a EditText?

I mean these lines:

enter image description here

Let’s say my EditText is 500 by 500 pixels in size. I want those lines to be visible across that 500 by 500 square.

Is there a build in way to do this? I already tried Google but I couldn’t find an answer.
I guess my other option is to dynamically create a graphic based on the textheight and linespacing, such an ugly work-around.

  • 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-05T12:17:17+00:00Added an answer on June 5, 2026 at 12:17 pm

    The notepad application sample from the android dev site shows you how to do this.

    http://developer.android.com/resources/samples/NotePad/index.html

    Looks like this (scroll down for code):

    Notepad

    Most of the relevant code is in this file. Pay attention to the LinedEditText inner class. It is defined within the activity. It draws the lines required.

    Inside the activity onCreate() method, setContentView(R.id.note_editor) is set as the view, it is defined like here

    Snippet extracted from here. Update: Code modified by @Pieter888 to draw lines on the entire EditText control.

    import android.content.Context;
    import android.graphics.Canvas;
    import android.graphics.Paint;
    import android.graphics.Rect;
    import android.util.AttributeSet;
    import android.widget.EditText;
    
    public class LinedEditText extends EditText 
    {
        private Rect mRect;
        private Paint mPaint;
    
        public LinedEditText(Context context, AttributeSet attrs) 
        {
            super(context, attrs);
            mRect = new Rect();
            mPaint = new Paint();
            mPaint.setStyle(Paint.Style.STROKE);
            mPaint.setColor(0xFF000000);
        }
    
        /**
         * This is called to draw the LinedEditText object
         * @param canvas The canvas on which the background is drawn.
         */
        @Override
        protected void onDraw(Canvas canvas) 
        {
            int height = canvas.getHeight();
            int curHeight = 0;
            Rect r = mRect;
            Paint paint = mPaint;
            int baseline = getLineBounds(0, r);
            for (curHeight = baseline + 1; curHeight < height; 
                                                     curHeight += getLineHeight())
            {
                canvas.drawLine(r.left, curHeight, r.right, curHeight, paint);
            }
            super.onDraw(canvas);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to show subcategories of categories in Wordpress? Let's say I have
Is it possible to show any part of image in img tag (with pixels)
Is it possible to show a dialog box to let the user select a
Is it possible to show hyperlinks in javascript alerts? I mean, if I do
Is it possible to show multiple lines of text in grid cells using the
Is it possible to show/hide all matching lines in vi or Vim? Not highlight
Is it possible to show more than 500 columns in a grid with a
Is it possible to show line numbers in the Developer Center when editing xslt
Is it possible to show the typical iPhone maps annotation/callout bubble (MKAnnotation), on something
Is it possible to show a tooltip without making a link? For example, I

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.