android - How do i display a textview over a button with custom layout? -
how display textview on custom button (that uses png res/drawable)?
i trying create ui wearable square watch android wear. created custom backgrounds change of 2 buttons want layout consist of. when add textview layout, placed under button, , never visible.
i have searched solutions, problem people using wrong layout. have tried both frame , relative layout, should both stack content on top of each other, doesn't.
although use text field in button itself, rather have dedicated textview text written inside. can't figure out problem is.
<?xml version="1.0" encoding="utf-8"?> <framelayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <textview android:id="@+id/textview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="text" android:textcolor="#ffffff" android:layout_gravity="center"/> <button android:id="@+id/wearable_alarm_button" android:layout_width="wrap_content" android:background="@drawable/red_button" android:layout_height="wrap_content" /> <button android:layout_width="130dp" android:layout_height="120dp" android:background="@drawable/blue_button" android:id="@+id/wearable_timer_button" android:layout_gravity="right|bottom" /> </framelayout>
add tag after tags like
<button android:id="@+id/wearable_alarm_button" android:layout_width="wrap_content" android:background="@drawable/red_button" android:layout_height="wrap_content" /> <button android:layout_width="130dp" android:layout_height="120dp" android:background="@drawable/blue_button" android:id="@+id/wearable_timer_button" android:layout_gravity="right|bottom" /> <textview android:id="@+id/textview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="text" android:textcolor="#ffffff" android:layout_gravity="center"/>
it show textview above buttons.
Comments
Post a Comment