XUI

Project address: github.com/xuexiangjys… Welcome to star collection.

A simple and elegant Android native UI framework, free your hands! Click on the instructions and try it out!

Covers most UI components: TextView, Button, EditText, ImageView, Spinner, Picker, Dialog, PopupWindow, ProgressBar, LoadingView, StateLayout, FlowLayout, Swit Ch, Actionbar, TabBar, Banner, GuideView, BadgeView, MarqueeView, WebView, SearchView, a series of components and colorful style themes.

Please read the instructions carefully before use, and say the important things three times!!

Please read the instructions carefully before use, and say the important things three times!!

Please read the instructions carefully before use, and say the important things three times!!

X series library fast integration

In order to facilitate you to quickly integrate the X series framework library, I provide an empty shell template for your reference: github.com/xuexiangjys…

In addition, I also specially made several video tutorials for you to learn reference.


Characteristics of the

  • Simple and elegant, with as few references as possible to the number of resource files, the overall size of the project library is less than 1M(about 644K after packaging)
  • Components are rich, providing most of the functional components that we often use as developers.
  • Simple to use, in order to facilitate rapid development, improve development efficiency, the API has been optimized to provide one-click access.
  • Unified style, the framework provides a series of unified style, so that the OVERALL UI looks beautiful and harmonious.
  • Compatibility is high. The framework also offers three different device sizes (4.5-inch, 7-inch, and 10-inch) and minimum compatibility to Android 17, making the UI even more compatible.
  • Each component provides rich attributes and style apis. You can set different style attributes to build different styles of UI.

How to use

Before you decide to use XUI, it’s important to understand that the framework provides a complete UI solution. If you only want to use a few controls, you don’t need to introduce such a large UI library. Github has a better component library. If you want to have a unified UI solution that can be customized, read on!

Add Gradle dependencies

1. Add build.gradle repositories in the project root directory:

allprojects {
     repositories {
        ...
        maven { url "https://jitpack.io" }
    }
}
Copy the code

2. Add to dependencies:

dependencies { ... / / androidx project implementation 'com. Making. Xuexiangjys: XUI: 1.1.5' implementation 'androidx. Appcompat: appcompat: 1.1.0' Implementation 'androidx. Recyclerview: recyclerview: 1.1.0' implementation 'com. Google. Android. Material: material: 1.1.0' Implementation 'com. Making. Bumptech. Glide: glide: 4.11.0'}Copy the code

Note: if your project is not currently using androidx, please use the following configuration:

dependencies { ... / / support project implementation 'com. Making. Xuexiangjys: XUI: 1.0.9 - support' implementation 'com. Android. Support: appcompat - v7:28.0.0' implementation 'com. Android. Support: recyclerview - v7:28.0.0' implementation 'com. Android. Support: design: 28.0.0' implementation 'com. Making. Bumptech. Glide: glide: 4.8.0'}Copy the code

Example Initialize XUI Settings

1. Initialize Settings at the top of Application (required)

XUI.init(this); // Initialize the UI frame xui. debug(true); // Enable the UI framework debug logCopy the code

2. Tweak the app’s base theme (mandatory)

The underlying theme of the application must be set or the component will not work properly! It is important to ensure that all Windows using the XUI component subclass the theme of the XUITheme.

Basic topic type:

  • Large Tablet (10 inches, 240dpi, 1920 x 1200) : XUITheme.Tablet.Big

  • Tablet (7 inches, 320dpi, 1920 x 1200) : XUITheme.Tablet.Small

  • Phone (4.5-inch, 320dpi, 720*1280) : XUITheme.Phone

<style name="AppTheme" parent="XUITheme.Phone"> 
 <! 
 <item name="colorPrimary">@color/colorPrimary</item> <item Name = "colorPrimaryDark" > @ color/colorPrimaryDark < item > < item name = "colorAccent" > @ color/colorAccent < item > college < / style >Copy the code

You can also set the theme dynamically at the start of your Activity by calling the following code

@Override protected void onCreate(Bundle savedInstanceState) { XUI.initTheme(this); super.onCreate(savedInstanceState); . }Copy the code

3. Adjust font library (if there is no requirement for font, it can be omitted)

(1) Set the font library path you need to modify (assets)

// Set the default font to Chinese typeface, here write your font library xui.getInstance ().initfontstyle ("fonts/hwxk.ttf");Copy the code

(2) Add the following code to inject fonts into the project’s base Activity.

Note: After version 1.1.4, use the following Settings for injection

@override protected void attachBaseContext(Context newBase) {// Inject font super.attachBaseContext(ViewPumpContextWrapper.wrap(newBase)); }Copy the code

Note: Version 1.1.3 and earlier use the following Settings for injection

@override protected void attachBaseContext(Context newBase) {// Inject font super.attachBaseContext(CalligraphyContextWrapper.wrap(newBase)); }Copy the code

Confuse configuration

-keep class com.xuexiang.xui.widget.edittext.materialedittext.** { *; }

Copy the code

demo

Demo program screenshot

Download the Demo

The demo program is about 18M (mainly because the demo integrates a small video shooting library is relatively large, about 13M, while XUI library is only 644K in size), the project is relatively large, so dandelion is recommended to download.

Dandelion download

Making the download

Special thanks to

  • QMUI_Android
  • AgentWeb
  • Android-Iconics
  • Android-PickerView
  • CityPicker
  • ELinkageScroll
  • FlycoBanner_Master
  • Linkage-RecyclerView
  • MaterialEditText
  • MaterialSpinner
  • MaterialProgressBar
  • MPAndroidChart
  • PictureSelector
  • SmartRefreshLayout
  • SlideBack
  • SwipeRecyclerView

Wechat official account

More information, welcome to wechat search public number: [My Android open source journey]