I have a custom view that looks a little like a speedometer.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:slider="http://schemas.android.com/apk/res-auto"
android:id="@+id/layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<com.mysite.view.SeekBar_Speedometer
android:id="@+id/slider"
slider:fill_clockwise_color="@color/lightgrey"
slider:fill_anticlockwise_color="@color/blue"
slider:fill_handle_color="@color/green"
slider:fill_handle_width="3"
slider:angle_start="120"
slider:angle_end="60"
slider:fill_start_angle="120"
slider:score_min="0"
slider:score_max="300"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</LinearLayout>
I would like to add an edittext to the center of the speedometer.
Just as you can draw text to the canvas can I add an edittext in the same way from inside my view? I don’t think so!
Question is, how do I go about adding this edittext to my custom view?
inside your custom view class you can do:
To do this your custom view must extends a ViewGroup (LinearLayout, RelativeLayout, ecc..)