Comments (8)
Hi @Amaranya,
Could you share with me your code
from android-about-page.
Sure,
Layout:
<android.support.design.widget.CoordinatorLayout 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"
android:fitsSystemWindows="true"
tools:context="activities.About">
<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>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!" />
</RelativeLayout>
</android.support.design.widget.CoordinatorLayout>
And code:
import android.support.design.widget.AppBarLayout;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.Toolbar;
import android.view.Gravity;
import android.view.View;
import android.widget.Toast;
import java.util.Calendar;
import mehdi.sakout.aboutpage.AboutPage;
import mehdi.sakout.aboutpage.Element;
import com.aleskovacic.eventslocator4.R;
public class About extends AppCompatActivity {
private AppBarLayout mAppBarLayout;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_about);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
mAppBarLayout = (AppBarLayout) findViewById(R.id.app_bar_layout);
ActionBar ab = getSupportActionBar();
if (ab != null) {
ab.setDisplayHomeAsUpEnabled(true);
ab.setTitle("About Us");
}
View aboutPage = new AboutPage(this)
.isRTL(false)
.setImage(R.mipmap.ic_launcher)
.addItem(new Element().setTitle("Version 6.2"))
.addGroup("Connect with us")
.addEmail("[email protected]")
.addFacebook("the.medy")
.addPlayStore("com.ideashower.readitlater.pro")
.create();
setContentView(aboutPage);
}
I tried to add
<item name="android:layout_marginTop">?attr/actionBarSize</item>
to styles - it works -layout moves lower, but AppBarLayout still doesn`t appear:(
from android-about-page.
Okay,
by calling setContentView(aboutPage);
you're telling your app to use the object aboutPage
as a content view, which will automatically ignore all previously declared views.
To fix this, you should add aboutPage
to an already declared view, like a linearlayout a framelayout ...
See more details at : #66
from android-about-page.
Thank you for answer, but this doesn`t work for me - activity crashes with error:
"java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.LinearLayout.addView(android.view.View, int)' on a null object reference"
this is my host 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"
/>
</android.support.design.widget.AppBarLayout>
Maybe you know what`s going wrong? I tried tried to change "about-page view position" in
mActivityRoot.addView(aboutPage, 1) from 1 to 0,2,3,4 - nothing works.
from android-about-page.
mActivityRoot is null, make sure you set an id for your linealayout view
<LinearLayout
android:id="@+id/main_view" ...>
</LinearLayout>
from android-about-page.
oh, sorry, Ive sent not full xml, it
s layout:
<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"
/>
</android.support.design.widget.AppBarLayout>
and in About.java:
setContentView(R.layout.activity_about);
LinearLayout mActivityRoot = ((LinearLayout) findViewById(R.id.about_toolbar));
mActivityRoot.addView(aboutPage, 1);
So, linearLayout R.id.about_toolbar is declared in both xml and class
from android-about-page.
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.
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)
- font HOT 2
- Incorrect image color, iconDrawable is dark HOT 1
- Ads Implementation HOT 1
- Facebook Page: Trouble Loading HOT 2
- Google Play Rating HOT 1
- Possible To Change Image Position ?
- How do I changed the background color of the about page? HOT 3
- Add App Gallery and Galaxy Store HOT 2
- Can't Implement Image as Web link HOT 3
- Auto night mode support HOT 2
- toolbar
- Email icon isn't visible in dark mode HOT 7
- About Page android
- Font is not use by typeface
- Impact of jCenter EOL HOT 1
- iOS About Page
- Not able to load external image HOT 2
- Add Phone Element Suggestion
- Strezless
- I would like you to add LinkedIn and whatsapp HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from android-about-page.