From 0ed3d42ee6bfcd708cb29c7f92f1008a62b257f7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Reimar=20D=C3=B6ffinger?= Date: Tue, 26 Dec 2017 13:02:16 +0100 Subject: [PATCH] Simplify LayoutParams. --- src/com/hughes/android/dictionary/DictionaryActivity.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/com/hughes/android/dictionary/DictionaryActivity.java b/src/com/hughes/android/dictionary/DictionaryActivity.java index 78b3b49..6072a6b 100644 --- a/src/com/hughes/android/dictionary/DictionaryActivity.java +++ b/src/com/hughes/android/dictionary/DictionaryActivity.java @@ -1598,6 +1598,7 @@ public class DictionaryActivity extends ActionBarActivity { final int rowCount = entry.pairs.size(); if (result == null) { result = new TableLayout(context); + result.setStretchAllColumns(true); // Because we have a Button inside a ListView row: // http://groups.google.com/group/android-developers/browse_thread/thread/3d96af1530a7d62a?pli=1 result.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS); @@ -1611,11 +1612,10 @@ public class DictionaryActivity extends ActionBarActivity { result.removeViews(rowCount, result.getChildCount() - rowCount); } - final TableRow.LayoutParams layoutParams = new TableRow.LayoutParams(); - layoutParams.weight = 0.5f; - layoutParams.leftMargin = mPaddingLarge; - for (int r = result.getChildCount(); r < rowCount; ++r) { + final TableRow.LayoutParams layoutParams = new TableRow.LayoutParams(0, LinearLayout.LayoutParams.WRAP_CONTENT); + layoutParams.leftMargin = mPaddingLarge; + final TableRow tableRow = new TableRow(result.getContext()); final TextView col1 = new TextView(tableRow.getContext()); -- 2.43.0