hayannn / Power-J

2022-2 모바일응용 팀프로젝트
0 stars 0 forks source link

My 화면 - '연관루틴 추천보기', '카테고리별 다양한 루틴 배워보기' 구현 완료(12/02) #9

Open hayannn opened 1 year ago

hayannn commented 1 year ago

My 화면의 '연관루틴 추천보기'와 '카테고리별 다양한 루틴 배워보기'에 대한 기능 구현을 완료했습니다.

사진 파일 -> drawble에 모두 넣은 다음 진행 my화면 연관루틴, 카테고리별 사진.zip

SuggestionActivity.java & activity_suggestion.xml

https://user-images.githubusercontent.com/102213509/205092498-69adbde1-f3f2-48ad-9715-707c209ddb58.mp4

메인 : ConnectRoutineActivity.java & activity_connectroutine.xml

운동(건강) : ConnectExerciseActivity.java & activity_connectexercise.xml

공부 : ConnectStudyActivity.java & activity_connectstudy.xml

취미생활 : ConnectHobbyActivity.java & activity_connecthobby.xml

생활습관 : ConnectHabitActivity.java & activity_connecthabit.xml

기타 : ConnectEtcActivity.java & activity_connectetc.xml

https://user-images.githubusercontent.com/102213509/205092944-4e83ea26-a90f-4892-9ed6-e50f1d03c957.mp4

hayannn commented 1 year ago

중요 : 제가 개별적으로 만든 현재 이 프로젝트에는 성취도 기능에 대한 코드가 없는 상태입니다. 이 점을 반드시 유의하여 AndroidMenifest.xml는 그대로 복사 붙여넣기 하지 마시고, 추가된 내용만 살펴 넣어주시기 바랍니다.

hayannn commented 1 year ago

AndroidMenifest.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.pjsetting">

    <uses-permission android:name="android.permission.INTERNET" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.Pjsetting"
        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=".SettingActivity" />
        <activity android:name=".Setting2Activity"/>
        <activity android:name=".Setting3Activity"/>
        <activity android:name=".Setting4Activity"/>
        <activity android:name=".Setting5Activity"/>

        <activity android:name=".ConnectRoutineActivity"/>
        <activity android:name=".ConnectExerciseActivity"/>
        <activity android:name=".ConnectStudyActivity"/>
        <activity android:name=".ConnectHobbyActivity"/>
        <activity android:name=".ConnectHabitActivity"/>
        <activity android:name=".ConnectEtcActivity"/>

        <activity android:name=".SuggestionActivity"/>
        <activity android:name=".FixActivity"/>
    </application>

</manifest>
hayannn commented 1 year ago

연관루틴 추천보기 부분

hayannn commented 1 year ago

SuggestionActivity.java


package com.example.pjsetting;

import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;

public class SuggestionActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_suggestion);
    }
}
hayannn commented 1 year ago

activity_suggestion.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="50dp"
        android:background="#000000">
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <ScrollView
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical">

                <LinearLayout
                    android:id="@+id/suggestion1"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:background="@drawable/suggestion1">
                </LinearLayout>

                <LinearLayout
                    android:id="@+id/suggestion2"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:background="@drawable/suggestion2">

                </LinearLayout>

                <LinearLayout
                    android:id="@+id/suggestion3"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:background="@drawable/suggestion3">
                </LinearLayout>

                <LinearLayout
                    android:id="@+id/suggestion4"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:background="@drawable/suggestion4">
                </LinearLayout>

                <LinearLayout
                    android:id="@+id/suggestion5"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:background="@drawable/suggestion5">
                </LinearLayout>
            </LinearLayout>
        </ScrollView>

    </LinearLayout>
</LinearLayout>
hayannn commented 1 year ago
hayannn commented 1 year ago

카테고리별 다양한 루틴 배워보기 부분

hayannn commented 1 year ago
hayannn commented 1 year ago

메인('카테고리별 다양한 루틴 배워보기' 버튼 클릭 시 바로 다음으로 넘어가는 액티비티)

hayannn commented 1 year ago

ConnectRoutineActivity.java


package com.example.pjsetting;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;

import androidx.appcompat.app.AppCompatActivity;

public class ConnectRoutineActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_connectroutine);

        ImageButton btn_connect_exercise = (ImageButton) findViewById(R.id.btn_connect_exercise);

        btn_connect_exercise.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                Intent intent = new Intent(ConnectRoutineActivity.this, ConnectExerciseActivity.class);
                startActivity(intent);
            }
        });

        ImageButton btn_connect_study = (ImageButton) findViewById(R.id.btn_connect_study);

        btn_connect_study.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                Intent intent = new Intent(ConnectRoutineActivity.this, ConnectStudyActivity.class);
                startActivity(intent);
            }
        });

        ImageButton btn_connect_hobby = (ImageButton) findViewById(R.id.btn_connect_hobby);

        btn_connect_hobby.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                Intent intent = new Intent(ConnectRoutineActivity.this, ConnectHobbyActivity.class);
                startActivity(intent);
            }
        });

        ImageButton btn_connect_habit = (ImageButton) findViewById(R.id.btn_connect_habit);

        btn_connect_habit.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                Intent intent = new Intent(ConnectRoutineActivity.this, ConnectHabitActivity.class);
                startActivity(intent);
            }
        });

        ImageButton btn_connect_etc = (ImageButton) findViewById(R.id.btn_connect_etc);

        btn_connect_etc.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                Intent intent = new Intent(ConnectRoutineActivity.this, ConnectEtcActivity.class);
                startActivity(intent);
            }
        });
    }
}
hayannn commented 1 year ago

activity_connectroutine.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="wrap_content"
        android:orientation="vertical">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:background="#000000">

        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:gravity="center">
                <ScrollView
                    android:layout_width="390dp"
                    android:layout_height="600dp">

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:orientation="vertical">

                        <TextView
                            android:layout_width="match_parent"
                            android:layout_height="90dp"
                            android:text="카테고리를 클릭하면 다양한 루틴을 배워볼 수 있어요!"
                            android:textSize="17dp"
                            android:gravity="center"/>

                        <ImageButton
                            android:id="@+id/btn_connect_exercise"
                            android:src="@drawable/connect_exercise"
                            android:layout_width="match_parent"
                            android:layout_height="90dp"/>

                        <ImageButton
                            android:id="@+id/btn_connect_study"
                            android:src="@drawable/connect_study"
                            android:layout_width="match_parent"
                            android:layout_height="90dp"/>

                        <ImageButton
                            android:id="@+id/btn_connect_hobby"
                            android:src="@drawable/connect_hobby"
                            android:layout_width="match_parent"
                            android:layout_height="90dp"/>

                        <ImageButton
                            android:id="@+id/btn_connect_habit"
                            android:src="@drawable/connect_habit"
                            android:layout_width="match_parent"
                            android:layout_height="90dp"/>

                        <ImageButton
                            android:id="@+id/btn_connect_etc"
                            android:src="@drawable/connect_etc"
                            android:layout_width="match_parent"
                            android:layout_height="90dp"/>

                    </LinearLayout>
                </ScrollView>
            </LinearLayout>

        </LinearLayout>

    </LinearLayout>

</LinearLayout>
hayannn commented 1 year ago

서브

hayannn commented 1 year ago

1. 운동(건강)

hayannn commented 1 year ago

ConnectExerciseActivity.java


package com.example.pjsetting;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageButton;
import android.widget.LinearLayout;

import androidx.appcompat.app.AppCompatActivity;

import org.jetbrains.annotations.NotNull;

public class ConnectExerciseActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_connectexercise);

        ImageButton exercise_video1 = (ImageButton) findViewById(R.id.exercise_video1);

        exercise_video1.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.youtube.com/watch?v=gMaB-fG4u4g"));
                startActivity(intent);
            }
        });

        ImageButton exercise_video2 = (ImageButton) findViewById(R.id.exercise_video2);

        exercise_video2.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.youtube.com/watch?v=YahXKYnc8K8"));
                startActivity(intent);
            }
        });

        ImageButton exercise_video3 = (ImageButton) findViewById(R.id.exercise_video3);

        exercise_video3.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.youtube.com/watch?v=-GJMwcES45A"));
                startActivity(intent);
            }
        });

    }
}
hayannn commented 1 year ago

activity_connectexercise.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"
    android:background="@drawable/connect_exercise_background">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:background="#000000">

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="225dp"
        android:background="@drawable/connect_exercise_top">
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <HorizontalScrollView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="22dp"
            >
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent">
                <ImageButton
                    android:id="@+id/exercise_video1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/youtube_exercise1"
                    android:layout_marginRight="8dp"/>

                <ImageButton
                    android:id="@+id/exercise_video2"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/youtube_exercise2"
                    android:layout_marginRight="8dp"/>
                <ImageButton
                    android:id="@+id/exercise_video3"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/youtube_exercise3"
                    android:layout_marginRight="8dp"/>

            </LinearLayout>
        </HorizontalScrollView>

        </LinearLayout>

    </LinearLayout>
hayannn commented 1 year ago

2. 공부

hayannn commented 1 year ago

ConnectStudyActivity.java


package com.example.pjsetting;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;

import androidx.appcompat.app.AppCompatActivity;

public class ConnectStudyActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_connectstudy);

        ImageButton study_video1 = (ImageButton) findViewById(R.id.study_video1);

        study_video1.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.youtube.com/watch?v=TtzvIKaaW_8"));
                startActivity(intent);
            }
        });

        ImageButton study_video2 = (ImageButton) findViewById(R.id.study_video2);

        study_video2.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.youtube.com/watch?v=2wNyfpY9kCU&t=1s"));
                startActivity(intent);
            }
        });

        ImageButton study_video3 = (ImageButton) findViewById(R.id.study_video3);

        study_video3.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.youtube.com/watch?v=3WW3GcY34Bw"));
                startActivity(intent);
            }
        });

    }
}
hayannn commented 1 year ago

activity_connectstudy.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"
    android:background="@drawable/connect_study_background">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:background="#000000">

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="231dp"
        android:background="@drawable/connect_study_top"></LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <HorizontalScrollView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="22dp"
            >
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent">
                <ImageButton
                    android:id="@+id/study_video1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/youtube_study1"
                    android:layout_marginRight="8dp"/>

                <ImageButton
                    android:id="@+id/study_video2"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/youtube_study2"
                    android:layout_marginRight="8dp"/>
                <ImageButton
                    android:id="@+id/study_video3"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/youtube_study3"
                    android:layout_marginRight="8dp"/>

            </LinearLayout>
        </HorizontalScrollView>

    </LinearLayout>

</LinearLayout>
hayannn commented 1 year ago

3.취미생활

hayannn commented 1 year ago

ConnectHobbyActivity.java


package com.example.pjsetting;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;

import androidx.appcompat.app.AppCompatActivity;

public class ConnectHobbyActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_connecthobby);
        ImageButton hobby_video1 = (ImageButton) findViewById(R.id.hobby_video1);

        hobby_video1.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.youtube.com/watch?v=4drvuDQpLUk"));
                startActivity(intent);
            }
        });

        ImageButton hobby_video2 = (ImageButton) findViewById(R.id.hobby_video2);

        hobby_video2.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.youtube.com/watch?v=pdm5yQNad-w"));
                startActivity(intent);
            }
        });

        ImageButton hobby_video3 = (ImageButton) findViewById(R.id.hobby_video3);

        hobby_video3.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.youtube.com/watch?v=wc9_eeKCeQw"));
                startActivity(intent);
            }
        });

    }
}
hayannn commented 1 year ago

activity_connecthobby.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"
    android:background="@drawable/connect_hobby_background">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:background="#000000">

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="225dp"
        android:background="@drawable/connect_hobby_top">
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <HorizontalScrollView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="22dp"
            >
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent">
                <ImageButton
                    android:id="@+id/hobby_video1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/youtube_hobby1"
                    android:layout_marginRight="8dp"/>

                <ImageButton
                    android:id="@+id/hobby_video2"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/youtube_hobby2"
                    android:layout_marginRight="8dp"/>
                <ImageButton
                    android:id="@+id/hobby_video3"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/youtube_hobby3"
                    android:layout_marginRight="8dp"/>

            </LinearLayout>
        </HorizontalScrollView>

    </LinearLayout>

</LinearLayout>
hayannn commented 1 year ago

4.생활습관

hayannn commented 1 year ago

ConnectHabitActivity.java


package com.example.pjsetting;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;

import androidx.appcompat.app.AppCompatActivity;

public class ConnectHabitActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_connecthabit);

        ImageButton habit_video1 = (ImageButton) findViewById(R.id.habit_video1);

        habit_video1.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.youtube.com/watch?v=bYTPGoqmqZs"));
                startActivity(intent);
            }
        });

        ImageButton habit_video2 = (ImageButton) findViewById(R.id.habit_video2);

        habit_video2.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.youtube.com/watch?v=YNO7dC650B8"));
                startActivity(intent);
            }
        });

        ImageButton habit_video3 = (ImageButton) findViewById(R.id.habit_video3);

        habit_video3.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.youtube.com/watch?v=RD3Ohl1Q7WQ"));
                startActivity(intent);
            }
        });

    }
}
hayannn commented 1 year ago

activity_connecthabit.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"
    android:background="@drawable/connect_habit_background">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:background="#000000">

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="240dp"
        android:background="@drawable/connect_habit_top"></LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <HorizontalScrollView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="22dp"
            >
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent">
                <ImageButton
                    android:id="@+id/habit_video1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/youtube_habit1"
                    android:layout_marginRight="8dp"/>

                <ImageButton
                    android:id="@+id/habit_video2"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/youtube_habit2"
                    android:layout_marginRight="8dp"/>
                <ImageButton
                    android:id="@+id/habit_video3"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/youtube_habit3"
                    android:layout_marginRight="8dp"/>

            </LinearLayout>
        </HorizontalScrollView>

    </LinearLayout>

</LinearLayout>
hayannn commented 1 year ago

5. 기타

hayannn commented 1 year ago

ConnectEtcActivity.java


package com.example.pjsetting;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;

import androidx.appcompat.app.AppCompatActivity;

public class ConnectEtcActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_connectetc);

        ImageButton etc_video1 = (ImageButton) findViewById(R.id.etc_video1);

        etc_video1.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.youtube.com/watch?v=uvaeGbN2ZGA"));
                startActivity(intent);
            }
        });

        ImageButton etc_video2 = (ImageButton) findViewById(R.id.etc_video2);

        etc_video2.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.youtube.com/watch?v=5wJi1gLun7o"));
                startActivity(intent);
            }
        });

        ImageButton etc_video3 = (ImageButton) findViewById(R.id.etc_video3);

        etc_video3.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.youtube.com/watch?v=nkQOAqK6h0Y"));
                startActivity(intent);
            }
        });

    }
}
hayannn commented 1 year ago

activity_connectetc.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"
    android:background="@drawable/connect_etc_background">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:background="#000000">

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="240dp"
        android:background="@drawable/connect_etc_top"></LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <HorizontalScrollView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="22dp"
            >
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent">
                <ImageButton
                    android:id="@+id/etc_video1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/youtube_etc1"
                    android:layout_marginRight="8dp"/>

                <ImageButton
                    android:id="@+id/etc_video2"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/youtube_etc2"
                    android:layout_marginRight="8dp"/>
                <ImageButton
                    android:id="@+id/etc_video3"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/youtube_etc3"
                    android:layout_marginRight="8dp"/>

            </LinearLayout>
        </HorizontalScrollView>

    </LinearLayout>

</LinearLayout>