diff --git a/AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/AwesomeTextView.java b/AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/AwesomeTextView.java index 7302aff..8471d4f 100644 --- a/AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/AwesomeTextView.java +++ b/AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/AwesomeTextView.java @@ -113,11 +113,13 @@ private void initialise(AttributeSet attrs) { markdownText = a.getString(R.styleable.AwesomeTextView_bootstrapText); setClickable(clickable); // allows view to reach android:state_pressed + + int gravity = a.getInt(R.styleable.AwesomeTextView_android_gravity, Gravity.CENTER); + setGravity(gravity); } finally { a.recycle(); } - setGravity(Gravity.CENTER); if (markdownText != null) { setMarkdownText(markdownText); diff --git a/AndroidBootstrap/src/main/res/values/attrs.xml b/AndroidBootstrap/src/main/res/values/attrs.xml index 962b1bc..3416594 100644 --- a/AndroidBootstrap/src/main/res/values/attrs.xml +++ b/AndroidBootstrap/src/main/res/values/attrs.xml @@ -63,6 +63,7 @@ + diff --git a/sample/src/main/res/layout/example_awesome_text_view.xml b/sample/src/main/res/layout/example_awesome_text_view.xml index 6028965..0e3148f 100644 --- a/sample/src/main/res/layout/example_awesome_text_view.xml +++ b/sample/src/main/res/layout/example_awesome_text_view.xml @@ -140,7 +140,8 @@ style="@style/wrapping_fa_text" android:textSize="30dp" app:bootstrapBrand="primary" - app:bootstrapText="Escaped \{fa_facebook\} icon" + app:bootstrapText="Escaped \{fa_facebook\} icon (gravity=start)" + android:gravity="start" tools:ignore="SpUsage" /> diff --git a/sample/src/main/res/layout/example_bootstrap_button.xml b/sample/src/main/res/layout/example_bootstrap_button.xml index 8001331..eed987c 100644 --- a/sample/src/main/res/layout/example_bootstrap_button.xml +++ b/sample/src/main/res/layout/example_bootstrap_button.xml @@ -466,8 +466,8 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="@dimen/micro_padding" - android:gravity="center" - android:text="Matching" + android:gravity="right" + android:text="Matching (gravity right)" app:bootstrapBrand="info" /> diff --git a/sample/src/main/res/layout/example_bootstrap_label.xml b/sample/src/main/res/layout/example_bootstrap_label.xml index 5bae3f4..cb50e31 100644 --- a/sample/src/main/res/layout/example_bootstrap_label.xml +++ b/sample/src/main/res/layout/example_bootstrap_label.xml @@ -244,8 +244,8 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="@dimen/micro_padding" - android:gravity="center" - android:text="Match Parent" + android:gravity="end" + android:text="Match Parent (gravity end)" app:bootstrapBrand="primary" />