英文:
How should i create an circle image view in Android studio using JAVA
问题
I am making an app like Instagram in Android Studio using JAVA framework and Firebase for the backend.
我正在使用Android Studio和JAVA框架以及Firebase后端制作类似Instagram的应用。
I want to know how I can make a circle image view in it that can be used for a profile picture.
我想知道如何在其中创建一个可用于个人资料图片的圆形图像视图。
英文:
I am making an app like Instagram in Android Studio using JAVA framework and Firebase for the backend.
I want to know how i can make circle image view in it that can be used for profile picture.
答案1
得分: -1
我相信你正在寻找以下结果 -
你应该使用一个非常流行的库CircularImageView
将库添加到你的build.gradle(Module App)
implementation 'com.mikhaellopez:circularimageview:4.2.0'
你可以像在xml中创建ImageView一样创建ImageView。
<com.mikhaellopez.circularimageview.CircularImageView
android:layout_width="250dp"
android:layout_height="250dp"
android:src="@drawable/image"
app:civ_border_color="#3f51b5"
app:civ_border_width="4dp"
app:civ_shadow="true"
app:civ_shadow_radius="10"
app:civ_shadow_color="#3f51b5"/>
在你的代码中,你可以引用相同的视图 -
CircularImageView circularImageView = findViewById(R.id.circularImageView);
请查看文档以获取更多自定义信息。
愉快编码!
英文:
I do believe you are looking for following result -
You should use a very popular library CircularImageView
Add library to your build.gradle(Module App)
implementation 'com.mikhaellopez:circularimageview:4.2.0'
You can create image view just like you create ImageView in your xml.
<com.mikhaellopez.circularimageview.CircularImageView
android:layout_width="250dp"
android:layout_height="250dp"
android:src="@drawable/image"
app:civ_border_color="#3f51b5"
app:civ_border_width="4dp"
app:civ_shadow="true"
app:civ_shadow_radius="10"
app:civ_shadow_color="#3f51b5"/>
In you code you can referance same view as -
CircularImageView circularImageView = findViewById(R.id.circularImageView);
Please check the documentation for more customization.
Happy Coding !
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论