0

This is a quick, probably yes/no question, but I'm trying to pretty up my xml and I'm wondering if there is a way to have a parent layout override the children's layout_width property? that way I can omit layout_width from every child node, for fewer lines of code?

3
  • Is the parent your own custom class? If so, the answer is "yes", as TableRow does this. Commented May 17, 2019 at 20:52
  • @CommonsWare That's interesting, I thought it was a 'fixed' thing that every xml element should have layout_width & layout_height. Is TableRow an exception to this case, or are they other such views as well? Commented May 17, 2019 at 20:57
  • @ChrisvinJem: TableLayout and TableRow are the only ones that I know of that set a default layout_width and layout_height for its children. It wasn't a widespread technique, and as a result I don't know the details of how those classes are doing what they are doing. But, the source is available, and so a sufficiently motivated person could figure out the mechanism. Commented May 17, 2019 at 21:03

1 Answer 1

1

Short: No. For layout width is requeired property.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.