I would like to create a button with a circular or rectangular background, text and image below or above the text.
Here is the CustomButton layout where I added objects (background and text - ImageView is missing):
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content"
android:orientation="horizontal" android:layout_width="wrap_content" android:layout_gravity="center_vertical|center_horizontal">
I would like to create a CustomButton object with the setText () and setImage () methods, which would change the text and image of the button and place several CustomButtons in the main layout.
Does anyone know how to create your own layout, put it in another layout (main) and change its elements from the activity associated with the main layout?
I am very grateful for your help.
Thanks!
source
share