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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:19:42+00:00 2026-06-05T22:19:42+00:00

I would like to have a custom view in my application that consists of

  • 0

I would like to have a custom view in my application that consists of an ImageView and optionally an overlay TextView. How can I combine these to create a single view? I need a single view because I plan to use the view to populate a GridView or ListView with items. Is the best way to use compound controls and does this work well with adapters and GridView?

  • 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-05T22:19:44+00:00Added an answer on June 5, 2026 at 10:19 pm

    You just create it like any other layout and then use that layout in your adapter for the gridview.

    Java Code:

    Cursor scheduleCursor = mDbHelper.fetchAllSchedules();
    startManagingCursor(scheduleCursor);
    
    String[] from = new String[] { ScheduleDBAdapter.SCHEDULE_MACHINE,
        ScheduleDBAdapter.SCHEDULE_PRIORITY,
        ScheduleDBAdapter.SCHEDULE_RUNPART,
        ScheduleDBAdapter.SCHEDULE_RUNJOB,
        ScheduleDBAdapter.SCHEDULE_OPERATOR,
        ScheduleDBAdapter.SCHEDULE_NXTJOB1,
        ScheduleDBAdapter.SCHEDULE_NXTPRT1,
        ScheduleDBAdapter.SCHEDULE_NXTJOB2,
        ScheduleDBAdapter.SCHEDULE_NXTPRT2 };
    int[] to = new int[] { R.id.txtMachine, R.id.txtPriority,
        R.id.txtRunningPart, R.id.txtRunningJob, R.id.txtOperator,
        R.id.txtNextJobNumber1, R.id.txtNextJobPart1,
        R.id.txtNextJobNumber2, R.id.txtNextJobPart2 };
    SimpleCursorAdapter schedule = new SimpleCursorAdapter(this,
        R.layout.customgrid, scheduleCursor, from, to);
    
    GridView gridview = (GridView) findViewById(R.id.gridview);
    gridview.setAdapter(schedule);
    

    customgrid.xml:

    <?xml version="1.0" encoding="utf-8"?>
    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/tableLayout1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:shrinkColumns="*"
        android:stretchColumns="*" >
    
        <TableRow
            android:id="@+id/tableRow1"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:gravity="center" >
    
            <TextView
                android:id="@+id/txtMachine"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="#000000"
                android:gravity="left"
                android:text="machine" />
    
            <TextView
                android:id="@+id/txtPriority"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="#ff0000"
                android:gravity="center"
                android:text="priority"
                android:textColor="#000000" />
        </TableRow>
    
        <TableRow
            android:id="@+id/tableRow2"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:gravity="center" >
    
            <TextView
                android:id="@+id/txtRunningPart"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_span="2"
                android:background="#000000"
                android:gravity="center"
                android:text="part #"
                android:textColor="#009900" />
        </TableRow>
    
        <TableRow
            android:id="@+id/tableRow3"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:gravity="center" >
    
            <TextView
                android:id="@+id/txtRunningJob"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_span="2"
                android:background="#000000"
                android:gravity="center"
                android:text="job #"
                android:textColor="#009900" />
        </TableRow>
    
        <TableRow
            android:id="@+id/tableRow4"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:gravity="center" >
    
            <TextView
                android:id="@+id/txtOperator"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_span="2"
                android:background="#000000"
                android:gravity="center"
                android:text="operator"
                android:textColor="#0000FF" />
        </TableRow>
    
        <TableRow
            android:id="@+id/tableRow5"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:gravity="center" >
    
            <TextView
                android:id="@+id/txtNextJobPart1"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="#000000"
                android:gravity="center"
                android:text="part #"
                android:textColor="#FFFF00" />
    
            <TextView
                android:id="@+id/txtNextJobNumber1"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="#000000"
                android:gravity="center"
                android:text="job #"
                android:textColor="#FFFF00" />
        </TableRow>
    
        <TableRow
            android:id="@+id/tableRow6"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:gravity="center" >
    
            <TextView
                android:id="@+id/txtNextJobPart2"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="#000000"
                android:gravity="center"
                android:text="part #"
                android:textColor="#FFFF00" />
    
            <TextView
                android:id="@+id/txtNextJobNumber2"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="#000000"
                android:gravity="center"
                android:text="job #"
                android:textColor="#FFFF00" />
        </TableRow>
    
    </TableLayout>
    

    And here it is in action:

    enter image description here

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

Sidebar

Related Questions

I have a custom-made view that extends the View class. I would like 2
I have authored some custom classes that I would like to create using XAML:
I have an application that I have written to view logs from custom applications
I have a grid control that I use throughout the application. I would like
I would like to create an custom View on Android. I have tried to
I have created a custom UIView that I would like to use on multiple
I would like to have an app include a custom font for rendering text,
I have a custom posttype in Wordpress 3. I would like to every post
I'm writing a custom ASP.NET webcontrol and would like it to have a collection
I would like to read custom setting which i have done in ServiceConfiguration.cscfg &

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.