구현할 내용
- Empty Project 생성시 자동으로 만들어지는 타이틀 바의 제거
- 플로팅 버튼으로 메뉴 생성
- 버튼 클릭시 액티비티 전환
res의 하위폴더인 themes에서 Base application theme
주석 바로 아래 설정을 NoActionBar
로 바꾸면 기존 타이틀 바가 제거된다.
<!-- Base application theme. -->
<style name="Theme.GiftMap" parent="Theme.MaterialComponents.DayNight.NoActionBar">
플로팅 버튼 UI 생성 (우측상단)
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/menubtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="24dp"
android:src="@drawable/menuico"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
// 버튼 클릭시 액티비티 이동
val intent = Intent(this, ManageActivity::class.java)
var menubtn : FloatingActionButton = findViewById(R.id.menubtn)
menubtn.setOnClickListener{startActivity(intent)}
}
}