How to create separate seekBar class - android

Following the instructions here: How to make custom seek bar in android? I was able to make my own custom seekbar that draws text inside the thumb. I know want to create my own seekbar class so that I can call it from my activity. I'm running into problems because when I create a seekbar in my main activity it does not work properly. I don't think I have set up the OnSeek Listener correctly. Here is my main class:
public class MainActivity extends Activity {
CustomSeekBar test;
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
test = (CustomSeekBar) findViewById(R.id.seekBar1);
setContentView(R.layout.activity_main);
}
}
Here is my CustomSeekBar class:
public class CustomSeekBar extends SeekBar implements OnSeekBarChangeListener {
String TAG = "TOUCHING";
SeekBar seekbar;
public CustomSeekBar(Context context, AttributeSet attrs) {
super(context, attrs);
// TODO Auto-generated constructor stub
}
#Override
public void onProgressChanged(SeekBar seekBar, int progress,
boolean fromUser) {
int value = seekBar.getProgress();
String valueString = value + "";
seekBar.setThumb(writeOnDrawable(R.drawable.thumbler_small, valueString));
Log.d(TAG, "Thumb is being touched");
}
#Override
public void onStartTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}
#Override
public void onStopTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}
public BitmapDrawable writeOnDrawable(int drawableId, String text) {
Bitmap bm = BitmapFactory.decodeResource(getResources(), drawableId)
.copy(Bitmap.Config.ARGB_8888, true);
Paint paint = new Paint();
paint.setColor(Color.BLACK);
paint.setTextSize(20);
Canvas canvas = new Canvas(bm);
canvas.drawText(text, 0, bm.getHeight() / 2, paint);
return new BitmapDrawable(bm);
}
}
Here is my activity_main.xml file:
<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" >
<SeekBar
android:name="com.example.customseekbarclass"
android:id="#+id/seekBar1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_margin="10dp"
android:indeterminate="false"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:progressDrawable="#drawable/styled_progress"
android:thumb="#drawable/thumbler_small" />
</RelativeLayout>
This is the way my directory is setup:
How do I setup the SeekBar in my main activity class so that it calls the methods from my SeekBar class?

you should switch
test = (CustomSeekBar) findViewById(R.id.seekBar1);
setContentView(R.layout.activity_main);
since R.id.seekBar1 belongs to activity_main.xml otherwise you will get null for test:
setContentView(R.layout.activity_main);
test = (CustomSeekBar) findViewById(R.id.seekBar1);
Then I would change the seekbar part of your layout this way
<com.example.CustomSeekBar
android:id="#+id/seekBar1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_margin="10dp"
android:indeterminate="false"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:progressDrawable="#drawable/styled_progress"
android:thumb="#drawable/thumbler_small" />

I solved this by calling the OnSeekBarChangeListener from my main activity class:
public class MainActivity extends Activity {
CustomSeekBar test;
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
test = (CustomSeekBar) findViewById(R.id.seekBar1);
test.setOnSeekBarChangeListener(test);
}
}
and adding the missing constructors from my CustomSeekBar class:
public class CustomSeekBar extends SeekBar implements OnSeekBarChangeListener {
String TAG = "TOUCHING";
SeekBar mSeekBar;
public CustomSeekBar(Context context) {
super(context);
}
public CustomSeekBar(Context context, AttributeSet attrs) {
super(context, attrs);
}
public CustomSeekBar(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
#Override
public void onProgressChanged(SeekBar seekBar, int progress,
boolean fromUser) {
// TODO Auto-generated method stub
int value = seekBar.getProgress();
String valueString = value + "";
seekBar.setThumb(writeOnDrawable(R.drawable.thumbler_small, valueString));
Log.d(TAG, "Thumb is being touched");
}
#Override
public void onStartTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
Log.d(TAG, "START");
}
#Override
public void onStopTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
Log.d(TAG, "STOP");
}
public BitmapDrawable writeOnDrawable(int drawableId, String text) {
Bitmap bm = BitmapFactory.decodeResource(getResources(), drawableId)
.copy(Bitmap.Config.ARGB_8888, true);
Paint paint = new Paint();
paint.setColor(Color.BLACK);
paint.setTextSize(20);
Canvas canvas = new Canvas(bm);
canvas.drawText(text, 0, bm.getHeight() / 2, paint);
return new BitmapDrawable(bm);
}
}

Related

App works on Emulator but not on real Phone, Add and Remove View

I am just drawing a Circle with canvas, and change the radius with a SeekBar. This Code works fine on Emulator, but on my phone the remove View thing doesn't work. Means the circle gets bigger and bigger, but not smaller on my phone.
What is the problem here ?
my Code:
public class Kreis extends Activity implements OnSeekBarChangeListener {
private SeekBar seekbar;
public static int radius = 30;
private TextView textview;
private static View alterKreis;
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_kreis);
this.seekbar = (SeekBar)findViewById(R.id.radiusbar);
this.textview = (TextView)findViewById(R.id.ausgabe);
seekbar.setOnSeekBarChangeListener(this);
}
#Override
public void onProgressChanged(SeekBar seekBar, int progress,
boolean fromUser) {
radius = seekbar.getProgress();
textview.setText(radius + "");
RelativeLayout lp=new RelativeLayout(this);
Circle view = new Circle(this);
lp.removeView(view);
RelativeLayout.LayoutParams params =
new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT,
LayoutParams.FILL_PARENT);
addContentView(view,params);
}
#Override
public void onStartTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}
#Override
public void onStopTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}
public class Circle extends View{
public Circle(Context context) {
super(context);
}
#Override
public void draw(Canvas canvas) {
Paint paint = new Paint();
paint.setColor(Color.GREEN);
// if(radius>0){
canvas.drawCircle(200,200,radius,paint);
// }
}
}
}

onTouch and OnDraw in SurfaceView

I am trying to draw based on my trace over the screen. In this process my onTouch and OnDraw is not being executed. Could you please assist me to correct this code ?
Xml
<LinearLayout
xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="100"
android:orientation="vertical"
android:background="#ffff0000" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="60"
android:gravity="center" >
<com.example.test2.PathDraw
android:id="#+id/surfaceView"
android:layout_width="match_parent"
android:layout_height="140dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="40"
android:gravity="center" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/lion" />
</LinearLayout>
MainActivity
public class MainActivity extends Activity {
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
PathDraw sineWaveSurfaceView = (PathDraw) findViewById(R.id.surfaceView);
}
}
PathDraw
public class PathDraw extends SurfaceView implements SurfaceHolder.Callback
{
private Context context;
// List<Point> points;
ArrayList<Point> points = new ArrayList<Point>();
public PathDraw(Context context) {
super(context);
// TODO Auto-generated constructor stub
}
public PathDraw(Context context, AttributeSet attrs) {
super(context, attrs);
// TODO Auto-generated constructor stub
this.context = context;
getHolder().addCallback(this);
}
public PathDraw(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
// TODO Auto-generated constructor stub
}
protected void OnDraw(Canvas canvas, int value) {
Paint paint = new Paint();
paint = new Paint(Paint.ANTI_ALIAS_FLAG);
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeWidth(2);
paint.setColor(Color.WHITE);
Path path = new Path();
boolean first = true;
for(Point point : points){
if(first){
first = false;
path.moveTo(point.x, point.y);
}
else{
path.lineTo(point.x, point.y);
}
}
canvas.drawPath(path, paint);
}
public boolean onTouch(View view, MotionEvent event) {
// if(event.getAction() != MotionEvent.ACTION_DOWN)
// return super.onTouchEvent(event);
Point point = new Point();
point.x = event.getX();
point.y = event.getY();
points.add(point);
invalidate();
Log.d("PathDraw", "point: " + point);
return true;
}
#Override
public void surfaceChanged(SurfaceHolder arg0, int arg1, int arg2, int arg3) {
// TODO Auto-generated method stub
}
#Override
public void surfaceCreated(SurfaceHolder arg0) {
// TODO Auto-generated method stub
}
#Override
public void surfaceDestroyed(SurfaceHolder arg0) {
// TODO Auto-generated method stub
}
}
OnTouch is not called
I also had the exact same problem earlier today.
Class PathDraw should implement OnTouchListener, then set the listener to itself, do something like this:
public class PathDraw extends SurfaceView implements OnTouchListener, SurfaceHolder.Callback{
...
public PathDraw(Context context){
super(context);
setOnTouchListener(PathDraw.this);
}
OnDraw is not called
This post might help:
Android Custom Layout - onDraw() never gets called

Android - Adding custom surfaceView to xml defined surfaceView not working

I am trying to add a custom surfaceView class to a surfaceView that has been declared in a xml layout. The problem is that I cannot get the custom class add the the xml defined surfaceView. Some how it just does not start.
This is my code:
MainActivity
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
sineWaveSurfaceView = (SineWaveSurfaceView) findViewById(R.id.surfaceView);
}
MainActivity Layout
<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:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<mark.dijkema.android.eindopdracht.SineWaveSurfaceView
android:id="#+id/surfaceView"
android:layout_width="fill_parent"
android:layout_height="100dp"
android:layout_marginTop="20dp" />
<ListView
android:id="#+id/song_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp" >
</ListView>
</RelativeLayout>
SineWaveSurfaceView Class
public class SineWaveSurfaceView extends SurfaceView implements SurfaceHolder.Callback
{
private Context context;
public SineWaveSurfaceView(Context context)
{
super(context);
// TODO Auto-generated constructor stub
this.context = context;
getHolder().addCallback(this);
Log.e("constructor", "done");
}
public SineWaveSurfaceView(Context context, AttributeSet attrs)
{
super(context, attrs);
// TODO Auto-generated constructor stub
}
public SineWaveSurfaceView(Context context, AttributeSet attrs, int defStyle)
{
super(context, attrs, defStyle);
// TODO Auto-generated constructor stub
}
protected void OnDraw(Canvas canvas, int value)
{
//canvas.drawColor(Color.WHITE);
Paint paint = new Paint();
paint.setColor(Color.WHITE);
float y = Float.valueOf(String.valueOf(value));
for(float x = 0; x < 200; x += 0.1f)
{
canvas.drawPoint(x, y, paint);
}
}
#Override
public void surfaceChanged(SurfaceHolder arg0, int arg1, int arg2, int arg3)
{
// TODO Auto-generated method stub
}
#Override
public void surfaceCreated(SurfaceHolder arg0)
{
// TODO Auto-generated method stub
Log.e("start", "started");
}
#Override
public void surfaceDestroyed(SurfaceHolder arg0)
{
// TODO Auto-generated method stub
}
}
The problem is that the Log.e("constructor", "done"); in the constructor of the SineWaveSurfaceView is not even showing up.
What am I doing wrong, because when I do something like
sineWaveSurfaceView = new sineWaveSurfaceView(this);
then it works, but it is not attached to the surfaceView defined in the xml layout.
As veryBadalloc explained in the comments, it appeared that inflating from xml starts the second constructor, thus my code was working after all.

How to draw a custom view inside a SurfaceView?

I am having trouble putting all the pieces together. I have 3 classes: DefaultActivity that extends Activity, MyView that extends SurfaceView, and ResistorView that extends a View.
What I want to know is how draw a resistor every time I click the button bAddResistor from the DefaultActivity class? Here are some parts from the 3 classes:
DefaultActivity.java
public class DefaultActivity extends Activity {
//MyView myView;
TextView myText;
ResistorView myResistor;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//myView = (MyView) findViewById(R.id.my_view);
//myView = new MyView(this, null);
//myResistor = new ResistorView(this);
//myView.setBackgroundColor(Color.WHITE);
//myView.setScrollContainer(true);
setContentView(R.layout.main);
final Button bAddResistor = (Button) findViewById(R.id.bAdd);
bAddResistor.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// Perform action on click
Global.numberOfResistors++;
Log.d("ButtonADD", "Button Add has been clicked");
}
});
}
}
MyView.java
public class MyView extends SurfaceView implements SurfaceHolder.Callback {
public MyView(Context context, AttributeSet attrs) {
super(context, attrs);
getHolder().addCallback(this);
}
#Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
}
#Override
public void surfaceChanged(SurfaceHolder holder, int format, int width,
int height) {
// TODO Auto-generated method stub
}
#Override
public void surfaceCreated(SurfaceHolder holder) {
Canvas c = holder.lockCanvas();
onDraw(c);
holder.unlockCanvasAndPost(c);
}
#Override
public void surfaceDestroyed(SurfaceHolder holder) {
// TODO Auto-generated method stub
}
}
ResistorView.java
public class ResistorView extends View {
private Path mSymbol;
private Paint mPaint;
//...Override Constructors...
public ResistorView(Context context) {
super(context);
init();
}
public ResistorView(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
private void init() {
mSymbol = new Path();
mPaint = new Paint();
mPaint.setAntiAlias(true);
mPaint.setStrokeWidth(2);
mPaint.setColor(-7829368);
mPaint.setStyle(Paint.Style.STROKE);
//...Your code here to set up the path,
//...allocate objects here, never in the drawing code.
mSymbol.moveTo(0.0F, 0.0F);
mSymbol.lineTo(0.0F, 50.0F);
mSymbol.lineTo(16.666666F, 58.333332F);
mSymbol.lineTo(-16.666666F, 75.0F);
mSymbol.lineTo(16.666666F, 91.666664F);
mSymbol.lineTo(-16.666666F, 108.33333F);
mSymbol.lineTo(16.666666F, 124.99999F);
mSymbol.lineTo(-16.666666F, 141.66666F);
mSymbol.lineTo(0.0F, 150.0F);
mSymbol.lineTo(0.0F, 200.0F);
mSymbol.offset(100.0F, 20.0F);
}
//...Override onMeasure()...
#Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
//Use this method to tell Android how big your view is
setMeasuredDimension(50, 50);
}
//...Override onDraw()...
#Override
public void onDraw(Canvas canvas) {
super.onDraw(canvas);
canvas.drawPath(mSymbol, mPaint);
}
}
and the main.xml layout
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/RelativeLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:ignore="HardcodedText" >
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/RightLayout"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_alignParentRight="true"
android:background="#00000000"
android:orientation="vertical" >
<Button
android:id="#+id/bAdd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Add RES" />
<Button
android:id="#+id/bDeleate"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Del RES" />
</LinearLayout>
<com.defaul.android.MyView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_toLeftOf="#id/RightLayout"
android:background="#ff000000" />
</RelativeLayout>
If I put the drawing code in MyView.onDraw it works fine, the resistor is drawn. What I want is to click a button and draw the resistor on the surface, so every time I click I want a resistor to be added to the surface view.
Probably I'm approaching this problem in the opposite direction. If anyone can point me in the right direction I would really appreciated it.
Since I could not find a way to do what I wanted with SurfaceView I just created a class that extends View and then just add that view to my main layout.
In case it might help someone, below is a simplified version of my code:
public class CircuitSolverActivity extends Activity {
/** Called when the activity is first created. */
RelativeLayout mLayout;
MyView mView;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mLayout = (RelativeLayout)findViewById(R.id.elementContainer);
}
public void bAddView(View view){
mView = new MyView(context);
mView.setBackgroundColor(Color.TRANSPARENT);
mLayout.addView(mView);
}
MyView class:
public class ResistorView extends View {
public ResistorView(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public ResistorView(Context context){
super(context);
init();
}
private void init() {
mSymbol = new Path();
mPaint = new Paint();
mPaint.setAntiAlias(true);
mPaint.setStrokeWidth(2);
mPaint.setColor(-7829368);
mPaint.setStyle(Paint.Style.STROKE);
mSymbol.moveTo(0.0F, 0.0F);
mSymbol.lineTo(0.0F, 50.0F);
}
#Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
canvas.drawPath(mSymbol, mPaint);
}

Buttons not working with Surface view

I am new to Android and I am trying to add start and reset buttons with a custom surface view. I am able to draw canvas with a circle which is moving with touch.
Now my problem is that when I click the start button, the circle must take its initial position (10,10).
My activity class
public class OpenGlActivity extends Activity implements OnClickListener {
GameView GameView;
FrameLayout Frame;
LinearLayout canvas;
Button btnStart, btnReset;
TutorialThread GameThread;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Set full screen view
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.main);
GameView = new GameView(this);
btnStart = (Button) findViewById(R.id.btnStart);
btnStart.setOnClickListener(this);
btnReset = (Button) findViewById(R.id.btnReset);
btnReset.setOnClickListener(this);
GameView.setOnTouchListener(this);
}
public void onClick(View v) {
switch (v.getId()) {
case R.id.btnStart:
Log.i("openGl", "play called");
GameView.setState();
// drawView.invalidate();
break;
case R.id.btnReset:
// GameView.play=true;
// GameView.reset();
Log.i("openGl", "RESETcalled");
// drawView.invalidate();
break;
}
}
}
Custom surfaceview class and thread class
class GameView extends SurfaceView implements SurfaceHolder.Callback {
String TAG = "GameView";
private TutorialThread _thread;
Paint paint = new Paint();
Paint red = new Paint();
Paint black = new Paint();
int x = 20;
int y = 20;
public GameView(Context context) {
super(context);
// TODO Auto-generated constructor stub
getHolder().addCallback(this);
_thread = new TutorialThread(getHolder(), this);
// TODO Auto-generated constructor stub
paint.setColor(Color.WHITE);
paint.setAntiAlias(true);
red.setColor(Color.RED);
red.setAntiAlias(true);
black.setColor(Color.BLACK);
black.setAntiAlias(true);
setFocusable(true);
}
public GameView(Context context, AttributeSet attrs) {
super(context, attrs);
getHolder().addCallback(this);
_thread = new TutorialThread(getHolder(), this);
// TODO Auto-generated constructor stub
paint.setColor(Color.WHITE);
paint.setAntiAlias(true);
red.setColor(Color.RED);
red.setAntiAlias(true);
black.setColor(Color.BLACK);
black.setAntiAlias(true);
setFocusable(true);
}
#Override
public boolean onTouchEvent(MotionEvent event) {
x = (int) event.getX();
y = (int) event.getY();
return true;
}
public void setState() {
Log.i(TAG, "in setState");
_thread.play();
}
#Override
public void onDraw(Canvas canvas) {
canvas.drawColor(Color.BLACK);
canvas.drawCircle(x, y, 10, red);
}
#Override
public void surfaceChanged(SurfaceHolder holder, int format, int width,
int height) {
// TODO Auto-generated method stub
}
#Override
public void surfaceCreated(SurfaceHolder holder) {
_thread.setRunning(true);
_thread.start();
}
#Override
public void surfaceDestroyed(SurfaceHolder holder) {
// simply copied from sample application LunarLander:
// we have to tell thread to shut down & wait for it to finish, or else
// it might touch the Surface after we return and explode
boolean retry = true;
_thread.setRunning(false);
while (retry) {
try {
_thread.join();
retry = false;
} catch (InterruptedException e) {
// we will try it again and again...
}
}
}
}
class TutorialThread extends Thread {
String TAG = "TutorialThread";
private SurfaceHolder _surfaceHolder;
private GameView _panel;
private boolean _run = false;
public TutorialThread(SurfaceHolder surfaceHolder, GameView panel) {
_surfaceHolder = surfaceHolder;
_panel = panel;
}
public void setRunning(boolean run) {
_run = run;
}
#Override
public void run() {
Canvas c;
while (_run) {
c = null;
try {
c = _surfaceHolder.lockCanvas(null);
synchronized (_surfaceHolder) {
_panel.onDraw(c);
}
} finally {
// do this in a finally so that if an exception is thrown
// during the above, we don't leave the Surface in an
// inconsistent state
if (c != null) {
_surfaceHolder.unlockCanvasAndPost(c);
}
}
}
}
public void play() {
synchronized (_surfaceHolder) {
_panel.x = 10;
_panel.y = 10;
Log.i(TAG, "in Play");
}
}
}
main.xml
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<com.example.opengl.GameView
android:id="#+id/gameView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="#+id/btnStart"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Start" />
<Button
android:id="#+id/btnReset"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Reset" />
</LinearLayout>
</FrameLayout>

Categories

Resources