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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:37:19+00:00 2026-06-10T06:37:19+00:00

Here is my XML. I want to align the icon to the left and

  • 0

Here is my XML.
I want to align the icon to the left and the text should appear right next to the icon, with some space, like you see elsewhere. But the text is showing up in the center. (or right aligned to the 2nd column, in two column layout)

 <?xml version="1.0" encoding="utf-8"?>
  <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/main_scroll"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:fillViewport="true" >

  <TableLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:background="@android:color/white"
    android:layout_margin="5dp"
    android:stretchColumns="2"  
    android:layout_height="wrap_content">

       <TableRow
        android:id="@+id/events_header"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="@android:drawable/list_selector_background"
        android:clickable="true"
        android:padding="5dip">
              <ImageView android:id="@+id/ImageView02" 
                  android:src="@drawable/event_icon"
                      android:layout_width="wrap_content"
          android:layout_height="wrap_content"
                  android:layout_gravity="center_vertical|left"
                  android:layout_margin="5dp">
              </ImageView>
              <TextView
                android:id="@+id/text1"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="View Events"
                android:layout_gravity="left"
                android:textSize="21dp"
                android:textStyle="bold"
                android:background="@android:color/black"
                android:textColor="@android:color/white" />
         </TableRow>
        </TableLayout>
   </ScrollView>

This is how it displays:

    [  *             View Events        ]
  • is the icon. I want to display like this.

    [  *  View Events                   ]
    
  • 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-10T06:37:21+00:00Added an answer on June 10, 2026 at 6:37 am

    Try changing android:stretchColumns="2" to android:stretchColumns="1" because column index starts with 0. So if you only have two columns then the second column stands at index 1.

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

Sidebar

Related Questions

I am trying to replace some text in a file replacetest.xml here is the
I'm trying to learn some XML Parsing here and I've been given some code
I've never used XML before, and now I must change the align of text.
here is my xml..I want to get apikey using dom parser...any help would be
I want to align the XML syntax displayed in a pre tag on a
I need to align a set of text fields in an absolute layout. Here
I want to show two buttons in a way that one button should align
Here is my dilemma: I have an XML, where I want to insert animation_sequence,however,
I want convert json to xml here is code public class ConvertJSONtoXML { public
i am parsing xml in jquery. i want to see one line of symbols

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.