#include<stdio.h>
#pragma warning(disable 4996) // scanf 사용시 버퍼오버플로우 경고 무시

int main(void) {
    int a,b = 0;
    scanf("%d",&a);
    scanf("%d",&b);
    printf("%d",a+b);
}

 

'Programming > Algorithm' 카테고리의 다른 글

SCPC 예제 #Day 1#  (0) 2017.12.27

앱을 만들다 보면 ScrollView 안에 RecyclerView를 사용할 때가 있다.

 

예를 들면, 커뮤니티에서 사용하는 게시판이 있다.

그런데 ScrollView 안에 RecylcerView를 사용하게 되면

ScrollView의 스크롤 

RecyclerView의 스크롤이 따로따로 다 움직이게 된다.

 

이를 해결하기 위해서는 

ScrollView를 NestedScrollView로 사용하면 된다

 

<androidx.core.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent">

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

        <androidx.recyclerview.widget.RecyclerView
                android:id="@+id/recyclerView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"/>

    </LinearLayout>

</androidx.core.widget.NestedScrollView>

먼저 기존에 있는 타이틀을 제거 해야한다

 

Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayShowTitleEnabled(false);

 

그후 xml 에서

 

 <androidx.appcompat.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@null"
        android:theme="?attr/actionBarTheme"
        app:titleTextAppearance="@style/ToolbarTitleText" >

        <TextView
            android:id="@+id/textView28"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Toolbar Title"
            android:layout_gravity="center"
            android:textColor="#000000"
            android:textSize="15dp"
            android:textStyle="bold" />
    </androidx.appcompat.widget.Toolbar>

 

여기서 중요한것은 TextView 의 android:layout_width 를 wrap_content로 해주는것과

android:layout_gravity="center" 로 지정하는것이다

+ Recent posts