Git Product home page Git Product logo

Comments (10)

medyo avatar medyo commented on July 1, 2024 5

Hi @nuhkoca,

Yes, it's totally possible, since the library is only generating a view. you could include it anywhere you like, here is a sample :

Create a layout file like the following.
The Linearlayout which will work as a host for our about-page view.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 
    android:id="@+id/main_view" ...>

    <android.support.v7.widget.Toolbar .../>

</LinearLayout>

The in your activity, apply the following trick :

setContentView(R.layout.activity_about);  // set your layout file normally 
LinearLayout mActivityRoot = ((LinearLayout) findViewById(R.id.main_view)); // our host view
mActivityRoot.addView(aboutView, 1); // Add about-page view to position 1 (since 0 is already taken by the toolbar)

Hope that answers your question.

from android-about-page.

medyo avatar medyo commented on July 1, 2024 1

Hi @IdiosApps,

Please use mActivityRoot.addView(aboutPage, 1); and try adding the layoutParams also

from android-about-page.

adukugideon avatar adukugideon commented on July 1, 2024 1

As @IdiosApps mentioned, following these steps give the toolbar, but the about page itself does not appear. Please help.

from android-about-page.

nuhkoca avatar nuhkoca commented on July 1, 2024

Thank you, it works !

from android-about-page.

IdiosApps avatar IdiosApps commented on July 1, 2024

I tried using the trick you shared, but I just have the toolbar and not the view we created and tried to add.

I tried
mActivityRoot.addView(aboutPage, 0); and got the aboutPage view, but no toolbar.
mActivityRoot.addView(aboutPage, 1); gives toolbar and not the aboutPage view.
mActivityRoot.addView(aboutPage); gives just the toolbar.

from android-about-page.

t0mjoad avatar t0mjoad commented on July 1, 2024

Hello @medyo:

I tried your last snippet to show the about content but I only see the toolbar. Position 1 shows a blank view.

I tried your recommendation to @IdiosApps with:

Activity.java

        View aboutView = new AboutPage(this)
....
                .create();

        aboutView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));

        mActivityRoot.addView(aboutView, 1);

layout.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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="match_parent"
tools:context=".AcercaDeActivity"
android:id="@+id/main_view">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/AppTheme.AppBarOverlay">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            app:popupTheme="@style/AppTheme.PopupOverlay" />

    </android.support.design.widget.AppBarLayout>

</LinearLayout>

But the result is the same. Do you know how can I solve this issue? Thanks!

from android-about-page.

medyo avatar medyo commented on July 1, 2024

Hi, I think you've an issue with LayoutParams, you need to set the right params

LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
aboutView.setLayoutParams(params);
mActivityRoot.addView(aboutView, 1, params);

from android-about-page.

gadearaujo avatar gadearaujo commented on July 1, 2024

As you approached, it still is not working. Can you help me? @medyo

from android-about-page.

royadityak94 avatar royadityak94 commented on July 1, 2024

@medyo , it just doesn't work. Either you should claim that you can't present a solution or provide with a full demoable example. About page is good, but only if we can integrate into our ecosystem. It's frustrating to find blank ideas from your end. You should test before putting it.

from android-about-page.

edwinmugendi avatar edwinmugendi commented on July 1, 2024

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("[email protected]")
                .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>



from android-about-page.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.