I am new to Android and i am learning SeekBars. in Google material design site i found Sliders from (com.google.android.material.slider.Slider) package instead of seekbars. I wonder what the difference is between Slider and SeekBar, which should I use and which is better? What is the purpose of implementing these two? I search a lot and There is no useful content on the internet
The following may not be entirely accurate to the last detail, but it illustrates some of the history well enough:
Slider is just the MDC version of SeekBar - named a little differently and with a lot more functionality.
First, there was only SeekBar - the original framework UI component bundled with Android.
Then, AndroidX libraries, previously called Support Libraries, were created for backporting new UI components and bugfixes to older phones which OEMs refused to update anymore. The AndroidX AppCompat subproject swaps out all your framework components for the "fixed" versions whenever you use AppCompatActivity. SeekBar -> AppCompatSeekBar, TextView -> AppCompatTextView...
The old Support Libraries also had a package named design which contained some of the then-new Material 1.0 components (CardView and whatnot) which didn't have a framework counterpart. That's the reason why there is no AppCompatCardView - because there is no framework CardView, so there is nothing to "fix" with AppCompat.
If I recall correctly, the design package of the Support Libraries later became the starting point for the Android implementation of Material Components when Material 2.0 was unveiled. Material Design has its own version of SeekBar which is called Slider and it can do everything the old Android SeekBar can plus a lot more.
As for which one to use? (Neither is "better", that kind of thinking is inapplicable)
If you're using the MDC library already, or if you need some of Slider's advanced capabilities, use Slider.
If you only need a simple line with a circle sliding between two extremes, use SeekBar instead of pulling the MDC library just for that.
Related
Is there any way to add widgets provided by Design Support Library in android studio design palette to drag & drop them in screen?
I am referring to android.support.design.widget.TextInputLayout, android.support.design.widget.TextInputEditText etc... in here:
I use some of them in my app and it compiles/runs on kitkat fine but I have to copy/paste them after googling or from old projects each time.
Am I doing something wrong on including them in my project or there is no way to display them there?
I am very new to Android Development, but can I ask why the FAB is not supported in Activity and only in AppCompactActivity. Correct me if I am wrong but it's my understanding that as long as you are not bothered with backwards compatibility then using Activity is the one to use as you can directly implement material themes and use the latest material design like CardViews RecyclerViews and other layouts like CoordinatorLayout. Why then when you want to use a material design feature like the FAB does it force you to use the AppCompactActivity, I thought using the one supporting higher APIs would work. Am I missing something here, I know there are third party libs I can use, but I really need to get my head around this...
FloatingActionButton is not a part of core android library. Rather it is a part of android support design library.
compile "com.android.support:design:27.0.2"
This means this class is not pre-installed in android devices. Also to use it, your activity must use one of the AppCompat themes. Hence you need to use appcompat library to use a default FAB.
compile "com.android.support:appcompat-v7:27.0.2"
However, you can find many open source third party libraries for FAB in GitHub.
I am working on an android application. I am going to design User Interface and i have to use material design in it. I want to know what is the difference between Android Material Design UI and Android UI without material design ?
How should i use material design in my application.
You simply have to provide UI which fits the suggestions and rules from https://material.io/guidelines/
That resource does describe, for example, minimum sizes for UI elements, padding, margin, etc.
For the newest SDK versions of android most of these rules are already applied into default ui elements in Android Studio.
Material design is a comprehensive guide for visual, motion, and interaction design across platforms and devices. See The documentation
Material Design can be used in API Level 21 (Android 5.0) and newer or via the v7 appcompat library, which is used on virtually all Android devices.
In Material Design lot of new things were introduced like Material Theme, new widgets, custom shadows, vector drawables and custom animations
For more information Go here
There are lot of UI libraries available which you can use in your application.Find out here
Recently I'm studying the usage of the appcompat support library and the design support library. And I met a strange question(at least for me) that I can't understand.
In the appcompat support library, there're several AppCompat* like components, such as AppCompatButton, AppCompatCheckBox... There's one same thing among these components - In the official doc all these components have such illustration,
This will automatically be used when you use Button in your layouts.
You should only need to manually use this class when writing custom
views.
or something like this.
Here come's the question. Since Button isn't AppCompatButton, how can it consider it as AppCompatButton when I use Button during the xml or created in code? How does it work?
Forgive my Cantonese English.
Short brief on how the AppComp decided which class to init -
When using the support library (AppCompat) using the support library widgets (e.g. android,support.v4.widget.Button) ,the library will use the appropriate implementation based on your Android OS.
For example ,if your OS support Button it will use the native implementation ,else it will use the AppCompat implementation.
In other words ,it defers to run time to decide what to use..
I assume this is the automatically part..
Is there a easy way to have our application look like ICS or JB?
Mainly the slider and the radio button. They look old when displayed in green.
Any hint about this?
There's a nice package available on github called HoloEverywhere.
One thing though, do not try pass it off as a ICS/JB Application, just because it "looks" like the user interface one would expect to see in a native ICS/JB Android set up.
Best that can be done with the project, is to target the latest SDK to guarantee your wide-market of Android usage, including GB.
Aim high, not low ;)
The best way is to use the Android Library 'Actionbar Sherlock'. This Library uses all native ICS Themes, etc for older devices.
ActionBarSherlock is an extension of the compatibility library designed to facilitate the use of the action bar design pattern across all versions of Android with a single API.