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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:59:50+00:00 2026-06-12T07:59:50+00:00

I want to make an application in which i don’t have any XML files.

  • 0

I want to make an application in which i don’t have any XML files.
Image and text for the grid view is dynamically added and I want it looks like text is above image.. And I want it in all..You can say it looks like gallery with having name of images above the image.

So please help me..

Thanking you in advance.

  • 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-12T07:59:51+00:00Added an answer on June 12, 2026 at 7:59 am
    Finally I made it on my own. And sharing to all if some one want to use it.
    
    package com.example.customlayout;
    
    import java.util.ArrayList;
    import android.os.Bundle;
    import android.app.Activity;
    import android.content.Context;
    import android.content.SharedPreferences;
    import android.util.Log;
    import android.view.View;
    import android.view.ViewGroup.LayoutParams;
    import android.view.WindowManager;
    import android.widget.CheckBox;
    import android.widget.CompoundButton;
    import android.widget.CompoundButton.OnCheckedChangeListener;
    import android.widget.ImageView;
    import android.widget.LinearLayout;
    import android.widget.ScrollView;
    import android.widget.TextView;
    import android.widget.Toast;
    
    public class MainActivity extends Activity  {
    
        int i,j;
        int counter=0;
        boolean flag=false;
        int tid=55523,cid=25;
        int imid=55423,l_id=0;
        SharedPreferences settings;
        String [] values= new String[]{"Sample1","Sample2","Sample3","Sample4","Sample5","Sample6","Sample7","Sample8","Sample9","Sample10","Sample11","Sample12","Sample13","Sample14","Sample15","Sample16","Sample17","Sample18","Sample19","Sample20"};
        private Integer[] mThumbIds = {
                R.drawable.sample_1, R.drawable.sample_2,
                R.drawable.sample_3, R.drawable.sample_4,
                R.drawable.sample_5, R.drawable.sample_1,
                R.drawable.sample_2, R.drawable.sample_3,
                R.drawable.sample_4, R.drawable.sample_5,
                R.drawable.sample_1, R.drawable.sample_2,
                R.drawable.sample_3, R.drawable.sample_4,
                R.drawable.sample_5, R.drawable.sample_1,
                R.drawable.sample_2, R.drawable.sample_3,
                R.drawable.sample_4, R.drawable.sample_5,
    
        };
        int pos=0;
        public static ArrayList<Integer> check = new ArrayList<Integer>(); 
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
    
            ScrollView sc = new ScrollView(getApplicationContext());
            sc.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
            LinearLayout ll = new LinearLayout(getApplicationContext());
            ll.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
            ll.setOrientation(LinearLayout.VERTICAL);
    
            for( i = 0;i<10;i++)
            {
                final LinearLayout ll1 = new LinearLayout(getApplicationContext());
                ll1.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
                ll1.setOrientation(LinearLayout.HORIZONTAL);
                for(j = 0;j<2;j++)
                {
    
                    ll1.addView(rowView(getApplicationContext()));
                }
                ll.addView(ll1);
            }
            sc.addView(ll);
            this.setContentView(sc);
        }
    
        private View rowView(Context context) {
            // TODO Auto-generated method stub
    
            WindowManager mWinMgr = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
            int displayWidth = mWinMgr.getDefaultDisplay().getWidth();
    
            final LinearLayout ll1 = new LinearLayout(getApplicationContext());
            ll1.setLayoutParams(new LayoutParams((displayWidth/2), LayoutParams.WRAP_CONTENT));
            ll1.setOrientation(LinearLayout.VERTICAL);
            ll1.setId(l_id);
    
            final LinearLayout ll2 = new LinearLayout(getApplicationContext());
            ll2.setLayoutParams(new LayoutParams((displayWidth/2), LayoutParams.WRAP_CONTENT));
            ll2.setOrientation(LinearLayout.HORIZONTAL);
            ll2.setId(l_id);
    
    
            final TextView tv = new TextView(context);
            tv.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
            tv.setId(tid--);
            tv.setPadding(20, 0, 0, 0);
            tv.setText(values[pos]);
    
            final CheckBox cb = new CheckBox(getApplicationContext());
    
            cb.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
            cb.setId(cid--);
            cb.setTag(counter);
    
            for(int x = 0 ; x < check.size(); x++)
            {
    
                if(check.contains(counter))
                {
                    cb.setChecked(true);
                }
            }
            counter++;
    
            cb.setOnCheckedChangeListener(new OnCheckedChangeListener() {
    
                @Override
                public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                    // TODO Auto-generated method stub
                    if(isChecked){
                        Integer pos1= (Integer) buttonView.getTag();
                        check.add(pos1);
                        Log.i("TAG_3", ""+pos1);
    
                    }else{
                        Integer pos2= (Integer) buttonView.getTag();
                        if(check.contains(pos2))
                        {
                        check.remove(pos2);
                        Log.i("TAG", ""+pos2+"removed");
                        }
    
                    }
                }
            });
    
    
            final ImageView img = new ImageView(context);
            img.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
            img.setId(imid--);
            img.setScaleType(ImageView.ScaleType.CENTER_CROP);
            img.setPadding(8, 8, 8, 8);
    
            img.setImageResource(mThumbIds[pos]);
    
            pos++;
            /*Log.i("Demo", ""+pos);
            Log.i("TAG", ""+i);
            Log.i("TAG1", ""+j);
            Log.i("TAG2", ""+tid);
            Log.i("TAG3", ""+imid);*/
    
            ll2.addView(cb);
            ll2.addView(tv);
            ll1.addView(ll2);
            ll1.addView(img);
            ll1.setOnClickListener(new View.OnClickListener() {
    
                @Override
                public void onClick(View v) {
                    // TODO Auto-generated method stub
    
                    Toast.makeText(getApplicationContext(), "ID of TextView is:"+ String.valueOf(tv.getId())+" \t ID of Imageview is:"+ String.valueOf(img.getId()), Toast.LENGTH_SHORT).show();    
                }
    
    
            });
            l_id++; 
    
            return ll1;
        }
    
    
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just want to know that can i make an application which have some
I want to make an application in C or C++ which have to monitor
I have a application written in wxPython which I want to make multilingual. Our
Suppose I want to make a Web application which uses a fixed width and
I want to make a Windows Form Application which only shows a timer as:
I want to make an console application of c which can run other applications
I want to make a number selector like in alarm application, which has two
In my application i want to use a functionality which can make the vibrate
I want to make an application which has Tab bar . In each TabBar
I have a relatively simple goal: I want to create a Cocoa application which

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.