]> git.ktnx.net Git - mobile-ledger.git/commitdiff
center vertically the text in the account row
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Fri, 7 Dec 2018 18:47:57 +0000 (18:47 +0000)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Fri, 7 Dec 2018 18:47:57 +0000 (18:47 +0000)
app/src/main/java/net/ktnx/mobileledger/AccountSummary.java
app/src/main/res/layout/content_account_summary.xml

index 8593430010bca00f3e51ae3c01cc5a244a6c8f3f..12436d5cc39c0af11f4d5a5f3d3188971b07f5d1 100644 (file)
@@ -16,6 +16,7 @@ import android.support.v7.app.AppCompatActivity;
 import android.support.v7.widget.Toolbar;
 import android.util.Log;
 import android.util.TypedValue;
+import android.view.Gravity;
 import android.view.Menu;
 import android.view.MenuItem;
 import android.view.View;
@@ -204,6 +205,7 @@ public class AccountSummary extends AppCompatActivity {
                 TableLayout t = new TableLayout(this);
                 TableRow r = new TableRow(this);
                 r.setLayoutParams(new TableRow.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
+                r.setGravity(Gravity.CENTER_VERTICAL);
                 r.setPadding(getResources().getDimensionPixelSize(R.dimen.activity_horizontal_margin), dp2px(4), getResources().getDimensionPixelSize(R.dimen.activity_horizontal_margin), dp2px(4));
                 if (even)
                     r.setBackgroundColor(getResources().getColor(R.color.table_row_even_bg, getTheme()));
@@ -217,6 +219,7 @@ public class AccountSummary extends AppCompatActivity {
                 TextView amt_tv = new TextView(this, null, R.style.account_summary_amounts);
                 amt_tv.setLayoutParams(new TableRow.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, 1f));
                 amt_tv.setTextAlignment(EditText.TEXT_ALIGNMENT_VIEW_END);
+                amt_tv.setGravity(Gravity.CENTER);
                 amt_tv.setMinWidth(dp2px(40f));
                 StringBuilder amt_text = new StringBuilder();
                 try (Cursor cAmounts = db.rawQuery("SELECT currency, value FROM account_values WHERE account = ?", new String[]{acc_name})) {
index 958cf4c9c3537a2857a0dbbe13333c1f839af1a1..30a1d60f23b0b0c5d532c7ae040b9a9adbd065aa 100644 (file)
@@ -52,6 +52,7 @@
                     android:layout_width="match_parent"
                     android:layout_height="match_parent"
                     android:background="@color/table_row_even_bg"
+                    android:gravity="center"
                     android:paddingStart="@dimen/activity_horizontal_margin"
                     android:paddingEnd="@dimen/activity_horizontal_margin">
 
@@ -63,7 +64,7 @@
                     <TextView
                         android:id="@+id/textView2"
                         style="@style/account_summary_amounts"
-                        android:text="123.45" />
+                        android:text="123,45\n678,90" />
                 </TableRow>
 
             </TableLayout>