material-components-android

Android: Is there a simple way to create rounded corners for a view without having to create a separate drawable each time?

回眸只為那壹抹淺笑 提交于 2020-08-25 21:17:01
问题 I have gone through various solutions on the internet, which enable us to create views with rounded corners. Most of them require the use of creating custom views, or to create a drawable in xml or a nine-patch each time we need a rounded corner view. The problem is that when I implement such views, I need to create a drawable for every such view, even if two views have everything but just the background color in common. This is kind of irritating for me and I've heard the iOS framework

Android: Is there a simple way to create rounded corners for a view without having to create a separate drawable each time?

六月ゝ 毕业季﹏ 提交于 2020-08-25 21:16:57
问题 I have gone through various solutions on the internet, which enable us to create views with rounded corners. Most of them require the use of creating custom views, or to create a drawable in xml or a nine-patch each time we need a rounded corner view. The problem is that when I implement such views, I need to create a drawable for every such view, even if two views have everything but just the background color in common. This is kind of irritating for me and I've heard the iOS framework

Android: Is there a simple way to create rounded corners for a view without having to create a separate drawable each time?

二次信任 提交于 2020-08-25 21:15:33
问题 I have gone through various solutions on the internet, which enable us to create views with rounded corners. Most of them require the use of creating custom views, or to create a drawable in xml or a nine-patch each time we need a rounded corner view. The problem is that when I implement such views, I need to create a drawable for every such view, even if two views have everything but just the background color in common. This is kind of irritating for me and I've heard the iOS framework

Programatically change background of Drawable, maintaining the corner radius

落爺英雄遲暮 提交于 2020-08-20 05:29:50
问题 interview_timeline_row.xml <LinearLayout android:id="@+id/interviewTimelineIconLayout" android:layout_width="52dp" android:layout_height="52dp" android:layout_marginTop="20dp" android:background="@drawable/timeline_row_icon_layout_bg" android:gravity="center" android:orientation="horizontal" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent"> <ImageView android:id="@+id/interviewTimelineRowIcon" android:layout_width="40dp" android:layout_height="40dp" android

Programatically change background of Drawable, maintaining the corner radius

谁说我不能喝 提交于 2020-08-20 05:29:26
问题 interview_timeline_row.xml <LinearLayout android:id="@+id/interviewTimelineIconLayout" android:layout_width="52dp" android:layout_height="52dp" android:layout_marginTop="20dp" android:background="@drawable/timeline_row_icon_layout_bg" android:gravity="center" android:orientation="horizontal" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent"> <ImageView android:id="@+id/interviewTimelineRowIcon" android:layout_width="40dp" android:layout_height="40dp" android

How to implement Menu display on Extended Floating Action Button click android

我们两清 提交于 2020-08-10 19:29:26
问题 I want to implement the Extended FAB button in the format mentioned on the material website (https://kstatic.googleusercontent.com/files/8f9b57829c943c97be7c4b2485cf678f041dfe7c7ef523cfb2e97f1aeee21431f83d98cc07befeeed904fabb258298e3a7ac95f9da5d3da7a4adcff658cea851) https://material.io/components/buttons-floating-action-button#types-of-transitions Kindly help on how to achieve the same. 回答1: You can use the Material motion and the Transition between Views. For example define in your layout:

bottomSheetDialogFragment full screen

佐手、 提交于 2020-07-31 07:31:28
问题 What I'm trying to achieve is something like Instagram in-app web browser, used when you click an ad: what I did, is I used a WebView bottomSheetDialogFragment, and I override onCreateDialog to get the full screen like this : @Override public Dialog onCreateDialog(Bundle savedInstanceState) { BottomSheetDialog bottomSheetDialog=(BottomSheetDialog)super.onCreateDialog(savedInstanceState); bottomSheetDialog.setOnShowListener(dialog -> { BottomSheetDialog dialogc = (BottomSheetDialog) dialog;

Implementation of Google design guidelines for Sliders

眉间皱痕 提交于 2020-07-18 08:42:28
问题 Yesterday I was looking for sliders in Android and found this website with the Google search: https://material.io/guidelines/components/sliders.html#sliders-discrete-slider I know that I can use a SeekBar in Android to implement sliders. However, Google seems to have very nice examples of discrete sliders but I cannot find any code examples. I already implemented a normal SeekBar that is looking like this: How can I make it look like this? (Difference: When I move my slider, there is no big

Make an arrow shape both side with xml

半世苍凉 提交于 2020-07-18 06:32:07
问题 I want to make a button shape like this Is there a way to do this with XML ? Actually I am looking for like this 回答1: It is not exactly what you are looking for, because it is not with realized with a XML. However with the new MaterialButton it is very simple to obtain it: Just define the Button in your layout: <com.google.android.material.button.MaterialButton app:cornerRadius="0dp" android:paddingLeft="24dp" android:paddingRight="12dp" .../> Then just use the ShapeAppearanceModel to define

Make an arrow shape both side with xml

﹥>﹥吖頭↗ 提交于 2020-07-18 06:31:11
问题 I want to make a button shape like this Is there a way to do this with XML ? Actually I am looking for like this 回答1: It is not exactly what you are looking for, because it is not with realized with a XML. However with the new MaterialButton it is very simple to obtain it: Just define the Button in your layout: <com.google.android.material.button.MaterialButton app:cornerRadius="0dp" android:paddingLeft="24dp" android:paddingRight="12dp" .../> Then just use the ShapeAppearanceModel to define