android-styles

How to override styles of a library which has its own Activity

不想你离开。 提交于 2019-12-21 08:23:52
问题 I have a library which has its own Activities with colorPrimary and colorPrimaryDark attributes. In the application which is using this library, there are different values for these color attributes. Is there a way to make the library use the style provided by the caller application? So that in the end, if the app has a green toolbar, the activities in the library would have a green toolbar, not the one defined in library theme. This is the library's theme: <style name="LibraryTheme" parent=

How to override styles of a library which has its own Activity

拥有回忆 提交于 2019-12-21 08:22:43
问题 I have a library which has its own Activities with colorPrimary and colorPrimaryDark attributes. In the application which is using this library, there are different values for these color attributes. Is there a way to make the library use the style provided by the caller application? So that in the end, if the app has a green toolbar, the activities in the library would have a green toolbar, not the one defined in library theme. This is the library's theme: <style name="LibraryTheme" parent=

Remove the shadow below TabLayout on android

試著忘記壹切 提交于 2019-12-21 07:54:23
问题 I'm trying to remove the shadow below tabs while using TabLayout, which is defined in a normal layout (and not as a part of a toolbar or actionbar). Setting theme as <item name="android:windowContentOverlay">@null<item/> or <item name="windowContentOverlay">@null<item/> didn't work. Also, setting elevation to 0 didn't help either. <android.support.design.widget.TabLayout xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/sliding_tabs" android:layout_width="match_parent"

How to create TextInputLayout with OutlineBox programmatically

戏子无情 提交于 2019-12-21 07:46:09
问题 I want to create TextInputLayout with Widget.MaterialComponents.TextInputLayout.OutlinedBox style. I tried many ways but couldn't get the required result. Here is my code. TextInputLayout textInputLayout = new TextInputLayout(getActivity(),null,R.style.Widget_MaterialComponents_TextInputLayout_OutlinedBox); textInputLayout.setHint("My Hint"); TextInputEditText editText = new TextInputEditText(textInputLayout.getContext()); textInputLayout.addView(editText); parentView.addView(textInputLayout)

How to create TextInputLayout with OutlineBox programmatically

夙愿已清 提交于 2019-12-21 07:45:56
问题 I want to create TextInputLayout with Widget.MaterialComponents.TextInputLayout.OutlinedBox style. I tried many ways but couldn't get the required result. Here is my code. TextInputLayout textInputLayout = new TextInputLayout(getActivity(),null,R.style.Widget_MaterialComponents_TextInputLayout_OutlinedBox); textInputLayout.setHint("My Hint"); TextInputEditText editText = new TextInputEditText(textInputLayout.getContext()); textInputLayout.addView(editText); parentView.addView(textInputLayout)

Disable Material Ripple on Tablayout

喜夏-厌秋 提交于 2019-12-21 07:22:17
问题 I am trying to remove the Material Ripple Effect on my TabLayout's Tabs. I am wondering if it is possible to do this? Any ideas please? I have tried setting the stateListAnimator to null but it still does not work <android.support.design.widget.TabLayout android:id="@+id/tabLayout" android:layout_width="match_parent" android:layout_height="wrap_content" android:stateListAnimator="@null"/> 回答1: app:tabBackground does not work in my case. This is my solution: tabLayout.setTabRippleColor(null);

White navigationbar with grey icons

北城余情 提交于 2019-12-21 05:49:23
问题 How can I get this style in my android app? White navigationbar and grey icons. An example is when opening the application drawer. I have tried many options but without success. the application minSdkVersion is 21, lollipop. I have seen this solution, but I have not managed to apply it: Status bar turns white and does not show content behind it Thanks in advanced. 回答1: For API >= 23 Try : getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); OR in style :

How to change SearchView elements' color?

孤街浪徒 提交于 2019-12-21 03:36:30
问题 I want to use SearchView in my project, but I have a problem with elements' color. Let me show you: its fragmentDialog where I have my SearchView I dont need to change bg color. The next picture is for example. I want to see SearchView elements without black bg. I have tried to change theme change style change tint but nothing is working. The search icon and anoter elements still white. Maybe I'm losing something? Can I do this in XML? Please, help me. 回答1: You need to use android.support.v7

Android Fixed size dialog dimension- What is Major & Minor?

南楼画角 提交于 2019-12-21 03:24:16
问题 What are these attributes stands for? The difference between major dimension and minor dimension? <style name="Theme.Base.AppCompat.Dialog.FixedSize" parent="android:Theme.Dialog"> <item name="windowFixedWidthMajor">@dimen/dialog_fixed_width_major</item> <item name="windowFixedWidthMinor">@dimen/dialog_fixed_width_minor</item> <item name="windowFixedHeightMajor">@dimen/dialog_fixed_height_major</item> <item name="windowFixedHeightMinor">@dimen/dialog_fixed_height_minor</item> ....... </style>

How to apply a theme to an Android Toolbar?

拥有回忆 提交于 2019-12-20 19:05:24
问题 I've spent an inordinate amount of time trying to figure out how to apply some simple styling to a Toolbar, but am utterly stumped. Specifically I want to change the colour of the Title and Subtitle and the overflow menu icon (three dots). I can set the text colours successfully in the layout, but not in the Theme, I have no idea why. <android.support.v7.widget.Toolbar theme="@style/Toolbar" android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr