InfoView
![]()
A simple and easy to use information view for Android.
Screenshot | Video demo |
---|---|
Download APK: https://github.com/marcoscgdev/InfoView/releases/download/1.0.0/app-debug.apk
Usage:
Adding the depencency
Add this to your root build.gradle file:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Now add the dependency to your app build.gradle file:
implementation 'com.github.marcoscgdev:InfoView:1.0.1'
Using the view
- XML
<com.marcoscg.infoview.InfoView
android:id="@+id/info_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
app:iv_title="Oops!"
app:iv_message="That should not have happened."
app:iv_icon="@drawable/ic_sad_emoji"
app:iv_buttonText="Try again"
app:iv_buttonTextColor="@color/colorAccent"
app:iv_showButton="true"/>
- Java
InfoView infoView = (InfoView) findViewById(R.id.info_view);
infoView.setTitle("Oops!");
infoView.setMessage("That should not have happened.");
infoView.setIconRes(R.drawable.ic_sad_emoji);
infoView.setButtonText("Try again");
infoView.setButtonTextColorRes(R.color.colorAccent);
infoView.setOnTryAgainClickListener(new InfoView.OnTryAgainClickListener() {
@Override
public void onTryAgainClick() {
Toast.makeText(MainActivity.this, "Try again clicked!", Toast.LENGTH_SHORT).show();
}
});
Using progressbar
infoView.setProgress(true); // Show the progressbar
infoView.setProgress(false); // Hide the progressbar and show the info content
See the
sample project to clarify any queries you may have.