medyo / android-about-page

Create an awesome About Page for your Android App in 2 minutes
2.04k stars 283 forks source link

Where to add and customize toolbar? #131

Closed mrcodekiddie closed 4 years ago

deep1931 commented 4 years ago

hi, have you found any solution?

medyo commented 4 years ago

The library only offers the about view, it's up to you to customize/hide/show the toolbar Check the official android documentation: https://developer.android.com/training/appbar/setting-up

edwinmugendi commented 2 years ago

Use TableLayout and then add the About Page as a view into the TableLayout

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_about);

        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        if (getSupportActionBar() != null){
            getSupportActionBar().setTitle(getString(R.string.about_sapamacash));
            getSupportActionBar().setDisplayHomeAsUpEnabled(true);
            getSupportActionBar().setDisplayShowHomeEnabled(true);
        }//E# if statement

        tableLayout = (TableLayout) findViewById(R.id.aboutLayout);

        String phone = "+254722906835";

        View aboutPage = new AboutPage(this)
                .isRTL(false)
                .setDescription(getString(R.string.about_us_text))
                .addEmail("info@sapamatech.com")
                .addItem(getPhoneElement(phone))
                .addWebsite("https://sapamacash.com/")
                .addFacebook("sapamatech")
                .addTwitter("sapamatech")
                .addYoutube("UCV-sIbWJ5HpO0qk6Hp7Sjfw")
                .addItem(getCopyRightsElement())
                .create();

        LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);

        aboutPage.setLayoutParams(params);

        tableLayout.addView(aboutPage, 1,params);

    }

<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    tools:context=".ui.activity.AboutActivity"
    android:id="@+id/aboutLayout">

    <com.google.android.material.appbar.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/AppTheme.AppBarOverlay">

        <androidx.appcompat.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="?attr/colorPrimary"
            app:layout_scrollFlags="scroll|enterAlways"/>

    </com.google.android.material.appbar.AppBarLayout>

</TableLayout>