하단에 버튼 배치 androidx.constraintlayout
<?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity">
<ProgressBar android:max="100" android:layout_gravity="top" android:layout_width="fill_parent" android:layout_height="4dp" android:paddingLeft="3dp" android:paddingRight="3dp" android:id="@+id/progressBar2" style="?android:progressBarStyleHorizontal" />
<kr.xza.zxc.MediaWebView android:id="@+id/activity_main_webview" android:layout_width="match_parent" android:layout_height="match_parent" android:focusableInTouchMode="true" android:scrollbarStyle="outsideOverlay" android:focusable="true" > </kr.xza.zxc.MediaWebView>
<SeekBar android:id="@+id/seekBar1" android:layout_width="match_parent" android:layout_height="wrap_content" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintBottom_toBottomOf="parent" android:layout_marginTop="44dp" android:layout_marginStart="8dp" android:layout_marginEnd="8dp" android:layout_marginBottom="55dp" android:max="10" android:progress="0" />
<Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="중지" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toLeftOf="@+id/button2" />
<Button android:id="@+id/button2" android:text="재생" android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_constraintHorizontal_chainStyle="packed" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintRight_toRightOf="@id/button1" />
</androidx.constraintlayout.widget.ConstraintLayout>
Button button = (Button)findViewById(R.id.button1); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // Toast.makeText(MainActivity.this, "1111.", Toast.LENGTH_SHORT).show(); Intent myintent = new Intent(MainActivity.this, MusicService.class); myintent.putExtra("text","stop:"); startService(myintent); if (!isService) { Toast.makeText(getApplicationContext(), "서비스가 실행 중이 아닙니다. ", Toast.LENGTH_LONG).show(); return; }
//bindService(myintent, conn, Context.BIND_AUTO_CREATE); //seekbarplay(); //String data= ms.getBroastData1(); //seekBar1.setProgress(Integer.parseInt(data)); //Toast.makeText(MainActivity.this, data, Toast.LENGTH_SHORT).show(); } });
//button2 이어듣기 Button button2 = (Button)findViewById(R.id.button2); button2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) {
Intent myintent = new Intent(MainActivity.this, MusicService.class); myintent.putExtra("text","replay:"); startService(myintent);
if (!isService) { Toast.makeText(getApplicationContext(), "서비스가 실행 중이 아닙니다. ", Toast.LENGTH_LONG).show(); return; } String data= ms.getBroastData(); seekBar1.setMax(Integer.parseInt(data)); Toast.makeText(MainActivity.this, data, Toast.LENGTH_SHORT).show(); } });
|