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

  • Home
  • SEARCH
  • 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 6380731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:18:20+00:00 2026-05-25T02:18:20+00:00

I have a layout like this in xml format. But I need to do

  • 0

I have a layout like this in xml format. But I need to do all these things programatically in java code. Means the whole xml file in java code. Can any body help me on this. I am new to android

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

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
        android:layout_height="50dp"
        android:id="@+id/layoutTop"

        >
        <Button android:id="@+id/btnBack" 
                android:text="Back"
                android:layout_width="100dp"
                android:layout_height="40dp"
                android:layout_marginTop="7dp"
                android:layout_alignParentLeft="true"
                android:layout_marginLeft="2dp" 
                android:textColor="#000000"

            /> 
        <ImageView 
            android:id="@+id/image"
            android:layout_width="wrap_content"
            android:layout_height="40dp" 
            android:src="@+drawable/logo"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="7dp"

        />

        <Button android:id="@+id/btnQuit" 
                android:text="Quit"
                android:layout_width="100dp"
                android:layout_height="40dp"
                android:layout_marginTop="7dp"
                android:textColor="#000000"
                android:layout_alignParentRight="true"
            />  

    </RelativeLayout>

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="370dp"
        android:id="@+id/layoutMiddle"
        android:layout_below="@+id/layoutTop"
        android:background="#ffffff"
        android:layout_marginRight="2dp"
        android:layout_marginLeft="2dp" 
        >

        <TextView 
            android:id="@+id/textView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" 
            android:textColor="#000000"
            android:textSize="15dp"
            android:textStyle="bold"
            android:layout_marginLeft="10dp"
            android:layout_marginTop="20dp"
        />
    </RelativeLayout>
     <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="40dp"
        android:layout_below="@+id/layoutMiddle"
        android:layout_alignParentBottom="true"
        android:layout_marginTop="2dp"
        android:layout_marginBottom="2dp"
        >

    <!-- <ProgressBar
        android:layout_width="220dp" 
        android:layout_height="20dip" 
        style="?android:attr/progressBarStyleHorizontal"
        android:progressDrawable="@drawable/progress_bar_states"
        android:id="@+id/progressbar_Horizontal"
        android:max="100"
        android:layout_marginTop="7dp"
        android:layout_marginLeft="2dp"
        android:indeterminateOnly="false" 
        /> -->

        <SeekBar
            android:layout_width="220dp" 
            android:layout_height="30dip" 
            style="?android:attr/progressBarStyleHorizontal"
            android:progressDrawable="@drawable/progress_bar_states"
            android:id="@+id/progressbar_Horizontal"
            android:max="100"
            android:layout_marginTop="5dp"
            android:layout_marginLeft="2dp"
            android:indeterminateOnly="false" 
        /> 

    <Button android:id="@+id/btnSend" 
                android:text="Send"
                android:layout_width="88dp"
                android:layout_height="40dp"
                android:layout_marginTop="2dp"
                android:layout_alignParentRight="true"
                android:layout_marginRight="2dp"    
                android:textColor="#000000"
                android:layout_alignParentBottom="true"
                /> 


     </RelativeLayout>

</LinearLayout>
  • 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-25T02:18:21+00:00Added an answer on May 25, 2026 at 2:18 am

    You can for xml file because it is faster.But if you need then you can do this:

    LinearLayout parent=new LinearLayout(this);
    RelativeLayout rl1=new RelativeLayout(this);
    RelativeLayout rl2=new RelativeLayout(this);
    RelativeLayout rl3=new RelativeLayout(this);
    

    You can add buttons and imageview and all.Then add

    rl1.addView(bt1);
    .......
    rl2.addView(img1);
    ....
    rl3.addView(bt2);
    .......
    parent.addView(rl1);
    parent.addView(rl2);
    parent.addView(rl3);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my layout xml file I have several buttons like this which share the
Hi to all, i have written something like this in the xml file <?xml
I want a Layout like this: But my code doesn't work. I can't achieve
I have an XML layout like this: <?xml version=1.0 encoding=utf-8?> <RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android android:orientation=vertical android:layout_width=match_parent
I have a very simple Android activity layout like this: <?xml version=1.0 encoding=utf-8?> <LinearLayout
I have a basic website nav layout that looks like this: <li class=folder parent_folder>
I have a layout similar to this: <div id=...><img src=...></div> and would like to
I have a layout issue. What I do is this: create TableLayout in xml
In my .xml file i have this format: <LinearLayout android:layout_orientation=vertical...> <ImageView>... </ImageView> <ScrollView ...>
I have a layout like this: <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=match_parent android:layout_height=match_parent android:orientation=vertical > <include layout=@layout/basicinfo

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.