android-button

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

How to create a circular outlined Material Button in Android?

折月煮酒 提交于 2020-07-18 04:25:58
问题 I am trying to create a button with an icon in the center. The top and bottom part of the circle are a little flat. Is there a way to do this without using corner radius? Here is my layout for the button. <com.google.android.material.button.MaterialButton android:id="@+id/start_dispenser_btn" style="@style/Widget.MaterialComponents.Button.OutlinedButton" android:layout_width="175dp" android:layout_height="175dp" android:padding="14dp" app:cornerRadius="150dp" app:icon="@drawable/ic_play_arrow

how to replace/change image button programmatically android

≯℡__Kan透↙ 提交于 2020-05-25 04:34:27
问题 I have an image button on my view which i need to change after user interaction. I dont find nothing like myImageButton.setDrawable Here is my xml for the button i want to change: <ImageButton android:id="@+id/stopButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignTop="@+id/buttons_background" android:layout_centerHorizontal="true" android:layout_marginTop="5dp" android:background="@null" android:src="@drawable/btn_play" /> The only line I

How to make multiple buttons open the same activity?

别等时光非礼了梦想. 提交于 2020-05-24 07:31:13
问题 I am new to Android and Java development and I am wondering how to make the buttons in the dashboard open the same activity but with different data for each fragment . this activity will work the same way for all the buttons the only thing changing is the sortalgorithm.java used 回答1: you can put a flag in your intent when you call startActivity(Intent intent) method. is something like this: //... Intent intent = new Intent(this, DisplayMessageActivity.class); Bundle b = new Bundle(); b

Material Components Default to colorAccent instead of colorPrimary

时光总嘲笑我的痴心妄想 提交于 2020-05-24 03:57:49
问题 My AppTheme in styles.xml looks like this: <style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar"> <!-- Customize your theme here. --> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> <item name="android:textColorPrimary">@color/textColorPrimary</item> <item name="android:windowTranslucentStatus">true</item> <item name="android:windowTranslucentNavigation"