فهرست منبع

Add method to retrieve title textview

For getting access to the title textview, to change visibility etc.
Josh Burton 10 سال پیش
والد
کامیت
8767782170
2فایلهای تغییر یافته به همراه17 افزوده شده و 0 حذف شده
  1. 7 0
      README.md
  2. 10 0
      library/src/main/java/com/afollestad/materialdialogs/MaterialDialog.java

+ 7 - 0
README.md

@@ -290,6 +290,13 @@ MaterialDialog dialog = //... initialization via the builder ...
 View view = dialog.getCustomView();
 ```
 
+If you want to get a reference to the title textview (e.g. to change visibility):
+
+```java
+MaterialDialog dialog = //... initialization via the builder ...
+TextView title = dialog.getTitleTextView();
+```
+
 If you want to get a reference to one of the dialog action buttons (e.g. to enable or disable buttons):
 
 ```java

+ 10 - 0
library/src/main/java/com/afollestad/materialdialogs/MaterialDialog.java

@@ -849,6 +849,16 @@ public class MaterialDialog extends DialogBase implements View.OnClickListener,
         }
     }
 
+    /**
+     * Retrieves the title textview of the dialog, allowing you to modify properties such as whether or not it's enabled.
+     *
+     * @return The view from the dialog's layout representing the title textview.
+     */
+    public final TextView getTitleTextView() {
+        if (view == null) return null;
+		return title;
+    }
+
     /**
      * Updates an action button's title, causing invalidation to check if the action buttons should be stacked.
      *