티스토리 뷰
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center"
android:background="#FFFFFF"
tools:context=".MainActivity">
<ImageView
android:id="@+id/ivProfile"
android:layout_width="200dp"
android:layout_height="200dp"
android:src="@drawable/iv_profile"/>
</LinearLayout>
MainActivity.java
package com.jwsoft.javaproject;
import androidx.appcompat.app.AppCompatActivity;
import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.shapes.OvalShape;
import android.os.Build;
import android.os.Bundle;
import android.widget.ImageView;
public class MainActivity extends AppCompatActivity {
private ImageView ivProfile;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ivProfile = findViewById(R.id.ivProfile);
ivProfile.setBackground(new ShapeDrawable(new OvalShape()));
if (Build.VERSION.SDK_INT >= 21) {
ivProfile.setClipToOutline(true);
}
}
}
'Android > Java' 카테고리의 다른 글
[Java] Generics (2) (0) | 2020.08.06 |
---|---|
[Java] Toolbar + include (0) | 2020.08.05 |
[Java] CoordinatorLayout + ViewPager2 + TabLayout (0) | 2020.08.03 |
[Java] import com.google.gson.* (0) | 2020.07.31 |
[Java] import org.json.* (0) | 2020.07.30 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- JSONObject
- handler
- 안드로이드
- 혀가 길지 않은 개발자
- Design Pattern
- ViewModel
- 자바
- Vue.js #Vue.js + javascript
- coroutine
- JSONArray
- 안드로이드 #코틀린 #Android #Kotlin
- TabLayout
- ViewPager2
- View
- Android
- java
- Kotlin
- XML
- ArrayList
- Architecture Pattern
- recyclerview
- James Kim
- Livedata
- activity
- MVVM
- 코틀린
- DataBinding
- fragment
- Intent
- CoordinatorLayout
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
글 보관함