Open hayannn opened 1 year ago
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.pjtodolist1">
<application
android:usesCleartextTraffic="true"
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Pjtodolist1"
tools:targetApi="31">
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".CalendarActivity"> </activity>
<activity android:name=".CalendarScheduleActivity"> </activity>
<activity android:name=".CalendarScheduleAddActivity"> </activity>
<activity android:name=".CalendarScheduleShowActivity"> </activity>
<activity android:name=".StudyActivity"/>
<activity android:name=".HobbyActivity"/>
<activity android:name=".LifestyleActivity"/>
<activity android:name=".EtcActivity"/>
<meta-data
android:name="com.naver.maps.map.CLIENT_ID"
android:value="q618nmd8vn" />
</application>
</manifest>
MainActivity.java
package com.example.pjtodolist1;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class MainActivity extends AppCompatActivity {
private Button btn_exercise;
private Button btn_study;
private Button btn_hobby;
private Button btn_lifestyle;
private Button btn_etc;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button btn_exercise = (Button) findViewById(R.id.btn_exercise);
btn_exercise.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(MainActivity.this, CalendarActivity.class);
startActivity(intent);
}
});
Button btn_study = (Button) findViewById(R.id.btn_study);
btn_study.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(MainActivity.this, StudyActivity.class);
startActivity(intent);
}
});
Button btn_hobby = (Button) findViewById(R.id.btn_hobby);
btn_hobby.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(MainActivity.this, HobbyActivity.class);
startActivity(intent);
}
});
Button btn_lifestyle = (Button) findViewById(R.id.btn_lifestyle);
btn_lifestyle.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(MainActivity.this, LifestyleActivity.class);
startActivity(intent);
}
});
Button btn_etc = (Button) findViewById(R.id.btn_etc);
btn_etc.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(MainActivity.this, EtcActivity.class);
startActivity(intent);
}
});
}
}
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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="wrap_content"
android:orientation="vertical"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="700dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="100dp"
android:layout_height="30dp"
android:text="나의 루틴"
android:textSize="23sp"
android:layout_marginTop="11dp"
android:layout_marginLeft="22dp"
android:layout_marginBottom="21dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="390dp"
android:layout_height="470dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp">
<ScrollView
android:layout_width="match_parent"
android:layout_height="470dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical">
<Button
android:id="@+id/btn_exercise"
android:layout_width="match_parent"
android:layout_height="111dp"
android:text="운동(건강)"/>
<Button
android:id="@+id/btn_study"
android:layout_width="match_parent"
android:layout_height="111dp"
android:text="공부"/>
<Button
android:id="@+id/btn_hobby"
android:layout_width="match_parent"
android:layout_height="111dp"
android:text="취미 생활"/>
<Button
android:id="@+id/btn_lifestyle"
android:layout_width="match_parent"
android:layout_height="111dp"
android:text="생활습관"/>
<LinearLayout
android:id="@+id/main_5"
android:layout_width="400dp"
android:layout_height="111dp"
android:orientation="vertical">
<Button
android:id="@+id/btn_etc"
android:layout_width="match_parent"
android:layout_height="111dp"
android:text="기타"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
</LinearLayout>
</LinearLayout>
메인화면 접속 시에 스크롤뷰를 이용해 각 카테고리를 볼 수 있도록 구성하여, 추후 하단에 네비게이션바가 있더라도 볼 수 있도록 구현했습니다.
https://user-images.githubusercontent.com/102213509/202938234-5062a983-7800-4e8c-8ea8-bfffa7c6fbec.mp4