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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T16:42:29+00:00 2026-05-14T16:42:29+00:00

I have the following xml object representing a ImageButton <?xml version=1.0 encoding=utf-8?> <ImageButton xmlns:android=http://schemas.android.com/apk/res/android

  • 0

I have the following xml object representing a ImageButton

<?xml version="1.0" encoding="utf-8"?>
<ImageButton
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/genreCellItemId" android:layout_weight="1"
  android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center"
  android:paddingLeft="5.0dip" android:paddingRight="5.0dip">
</ImageButton>

I try to inflate it and add it to a TableRow with the following code :

LayoutInflater inflater= this.getLayoutInflater();
TableLayout grid = (TableLayout)findViewById(R.id.bodyTableLayout);
TableRow row = (TableRow)inflater.inflate(R.layout.genre_row, null);
View myButton = (View)inflater.inflate(R.layout.genre_cell, null);
row.addView(tempButton, new TableRow.LayoutParams());
grid.addView(row, new TableLayout.LayoutParams());

Ok so I noticed that it didn’t look as expected, so I fire up the Hierarchy Viewere and noticed that the ImageButton’s actually have an layout_width = FILL_PARENT instead of WRAP_CONTENT, also the layout_gravity is NONE and there is no padding to be seen…

Do, am I inflating it wrongly ? Or is maybe the new TableRow.LayoutParams() part doins omething wrong ?

  • 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-14T16:42:30+00:00Added an answer on May 14, 2026 at 4:42 pm

    Well after nearly two days I have found the culprit :

    As I actually suspected the new LayoutParams() is a problem if you already have “formatted” your View in the XML declaration…
    So after leaving the new LayoutParams() out of the equation my Table would be shown just fine…

    So just use :

    grid.addView(row);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following itemrenderer <?xml version=1.0 encoding=utf-8?> <s:MXAdvancedDataGridItemRenderer xmlns:fx=http://ns.adobe.com/mxml/2009 xmlns:s=library://ns.adobe.com/flex/spark xmlns:mx=library://ns.adobe.com/flex/mx focusEnabled=true> <s:Label id=lblData
Lets say I have the following XML file: <?xml version=1.0 encoding=utf-8?> <Customers xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:noNamespaceSchemaLocation=Customer.xsd>
I have the following XML: <?xml version=1.0 encoding=UTF-8?> <gnm:Workbook xmlns:gnm=http://www.gnumeric.org/v10.dtd xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:schemaLocation=http://www.gnumeric.org/v9.xsd> <office:document-meta xmlns:office=urn:oasis:names:tc:opendocument:xmlns:office:1.0
i have following xml <?xml version=1.0 encoding=UTF-8 ?> <Users> <User> <ID>SMSUser(63)</ID> <Email>a@example.com</Email> </User> <User>
I have the following XML document: <?xml version=1.0 encoding=UTF-8?> <objects> <object>Clutch</object> <object>Gearbox</object> <object>Cylinder head</object>
I have the following XML document: <application xmlns=http://www.example.com/schemas/app-config/1.0 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:schemaLocation=http://www.example.com/schemas/app-config/1.0 http://www.example.com/schemas/app-config/1.0/app-config-1.0.xsd> <info name=Dummy Application
I have the following XML file: <?xml version=1.0 encoding=utf-8 ?> <scripts> <ScriptName> <name> My
lets say i have the following XML <?xml version=1.0 encoding=utf-8?> <names> <name first=John last=Doe/>
Say I have this following XML structure: <?xml version=1.0 encoding=UTF-8?> <main> <parent> <child1>some value</child1>
I have the following sample XML: <?xml version=1.0 encoding=utf-8 ?> <queryableData> <table displayName=Shipments dbName=Quotes>

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.