728x90
ComparingPerformanceBar 라이브러리를 사용해서, 독특한 막대그래프를 만들어보겠습니다.
build.gradle(Module)
dependencies {
...
implementation 'io.github.cliffgr:cpbar:1.1.0'
...
}
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:gravity="center"
android:layout_height="match_parent">
<com.cliff.comparingperformancebar.PercentageProgressBar
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:id="@+id/chart"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:percentage="50"
app:progressLeftColor="#77B9C1"
app:progressRightColor="#45718B"
app:textSize="18sp" />
</androidx.constraintlayout.widget.ConstraintLayout>
MainActivity.java
public class MainActivity extends AppCompatActivity {
PercentageProgressBar valueProgressBar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
valueProgressBar = findViewById(R.id.chart);
valueProgressBar.setProgress((float) 34);
}
}
'안드로이드 자바' 카테고리의 다른 글
[Java][Android] 별점 만들기 (CustomView 만들기) (0) | 2022.04.05 |
---|---|
[Java][Android] JAVA 1대 1 콘솔 채팅 (client 구현하기) (0) | 2022.04.03 |
[Java][Android] 안드로이드 로그 (Log) 와 종류 알아보기 (0) | 2022.03.28 |
[Java][Android] 안드로이드 TextView 클릭시 색깔 변경 (0) | 2022.03.26 |
[Java][Android] JAVA 1대 1 콘솔 채팅 (server 구현하기) (0) | 2022.03.22 |