Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to include canvas into a layout
    text
    copied!<p>I have designed a canvas , now i want to include it into the xml file , how can i do this ?</p> <p>My MainActivity file is as below:</p> <pre><code> public class MainActivity extends Activity { CircularSeekBar circularSeekbar; private AudioManager audioManager = null; @Override protected void onCreate(Bundle savedInstanceState) { supe`enter code here`r.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TextView tx =(TextView) findViewById(R.id.mytext); circularSeekbar =(CircularSeekBar) findViewById(R.id.mycanvas); audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); circularSeekbar = new CircularSeekBar(this); ------------------- } </code></pre> <p>my xml file looks like this :</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/rel"&gt; &lt;TextView android:id="@+id/mytext" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:text="Value" /&gt; &lt;com.example.semicirseek.MyCanvas android:id="@+id/mycanvas" android:layout_width="wrap_content" android:layout_height="90dp" android:layout_centerHorizontal="true" android:layout_marginTop="88dp" android:max="255" android:progress="0" /&gt; &lt;/RelativeLayout&gt; </code></pre> <p>The problem is the canvas comes on the screen when i run the app</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload