Can´t get it to work..please help me
See original GitHub issueI don´t know what iswrong. I tried all day long but it seems that the lib wont work in my activity.
Tested also with different activities, different layout files and different styles. Also copy and pasting your sample code was not working. I think I set it up correctly but who knows…
-all updated -followed the readme and the sample code
maybe my layout.xml is the problem?
Activity
public class ProfileActivity extends MaterialAboutActivity {
private Toolbar mToolbar;
// Profile name and tagline
TextView tagline;
CollapsingToolbarLayout profile_title;
// Pic
CircleImageView profile_pic;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.profile_activity);
mToolbar = (Toolbar) findViewById(R.id.profile_toolbar);
View target = findViewById(R.id.circle_collapsed_target);
profile_pic = (CircleImageView) findViewById(R.id.profile_pic);
tagline = (TextView)findViewById(R.id.profile_expanded_tagline);
profile_title = (CollapsingToolbarLayout)findViewById(R.id.toolbar_layout);
if (mToolbar != null) {
setSupportActionBar(mToolbar);
//set back arrow in the toolbar
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowTitleEnabled(false);
}
setupProfile();
}
private void setupProfile() {
tagline.setText("TAGLINE");
profile_title.setTitle("TEST");
//profile_pic.setImageDrawable(TODO);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
//getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
onBackPressed();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
@NonNull
@Override
protected MaterialAboutList getMaterialAboutList(@NonNull Context context) {
MaterialAboutCard.Builder infoCard = new MaterialAboutCard.Builder();
infoCard.title("Info");
infoCard.addItem(new MaterialAboutTitleItem.Builder()
.text("TEST")
.desc("Dedscription")
.icon(new IconicsDrawable(context)
.icon(GoogleMaterial.Icon.gmd_wb_sunny)
.color(getResources().getColor(R.color.md_grey_400)
).sizeDp(18))
.build());
infoCard.addItem(ConvenienceBuilder.createPhoneItem(context,
new IconicsDrawable(context)
.icon(GoogleMaterial.Icon.gmd_phone)
.color(ContextCompat.getColor(context, R.color.md_grey_900))
.sizeDp(18),
"Phonenumber",
true,
"+39 12 3456 7890"));
infoCard.addItem(ConvenienceBuilder.createVersionActionItem(context,
new IconicsDrawable(context)
.icon(GoogleMaterial.Icon.gmd_info_outline)
.color(ContextCompat.getColor(context, R.color.md_grey_900))
.sizeDp(18),
"Version",
true));
return new MaterialAboutList.Builder()
.addCard(infoCard.build())
.build();
}
@Nullable
@Override
protected CharSequence getActivityTitle() {
return getString(R.string.app_name);
}
Layout
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/toolbar_layout"
android:layout_width="match_parent"
android:layout_height="280dp"
android:minHeight="108dp"
android:fitsSystemWindows="true"
app:title="Name"
app:contentScrim="@color/md_grey_900"
app:expandedTitleGravity="center_horizontal"
app:expandedTitleMarginTop="140dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap">
<ImageView
android:id="@+id/background"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@mipmap/pizza_slice"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.8"
android:scaleType="centerCrop"/>
<FrameLayout
android:id="@+id/profile_framelayout"
android:layout_width="match_parent"
android:layout_height="120dp"
android:layout_gravity="bottom|center_horizontal"
android:background="@color/md_grey_900"
android:orientation="vertical"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.5"
>
<LinearLayout
android:id="@+id/profile_linearlayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical"
>
<TextView
android:id="@+id/profile_expanded_tagline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="4dp"
android:text="Tagline"
android:textColor="@android:color/white"
/>
</LinearLayout>
</FrameLayout>
<android.support.v7.widget.Toolbar
android:id="@+id/profile_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
android:popupTheme="@style/AppTheme.PopupOverlay">
<Space
android:id="@+id/circle_collapsed_target"
android:layout_width="40dp"
android:layout_height="40dp"/>
</android.support.v7.widget.Toolbar>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none"
app:behavior_overlapTop="15dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:minHeight="?attr/actionBarSize"
android:background="@color/white"
app:cardElevation="8dp"
app:cardCornerRadius="@dimen/cardview_default_radius"
app:contentPadding="8dp"
>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lineSpacingExtra="8dp"
android:textColor="@color/md_black_1000"
android:text="test"
android:textSize="18sp"
/>
</android.support.v7.widget.CardView>
</android.support.v4.widget.NestedScrollView>
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/profile_pic"
android:layout_width="@dimen/image_width"
android:layout_height="@dimen/image_width"
android:src="@drawable/profile"
android:layout_marginTop="100dp"
android:layout_gravity="start|top"
android:elevation="8dp"
app:civ_border_width="0dp"
app:civ_border_color="@color/white"
app:collapsedTarget="@id/circle_collapsed_target"
app:layout_behavior=".AvatarImageBehavior"
/>
</android.support.design.widget.CoordinatorLayout>
I wanted the library to display inside my NestedScrollView but I havent found an option to select where the cards are displayed so I tried with an empty activity.xml but also there the cards are not displayed. The methode is called everytime but no visible result.?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Fix issues with “Hey Google” - Google Search Help
Troubleshoot Android phones & tablets If your Google Assistant doesn't work or respond to “Hey Google” on your Android device, make sure Google...
Read more >What to Do When You Can't Find a Job: 13 Tips | FlexJobs
Don't despair. These tips can help you find a job that you love. ... It can be disheartening not to see results from...
Read more >Find a Job | USAGov
Finding and getting a job can be a challenging process. Knowing more about job search methods and application techniques can help.
Read more >How To Fix Youtube App Not Working Problem
... please feel free to contact us by visiting our website at https://www.softbayglobal.com and ... Your browser can ' t play this video....
Read more >Fix all google play store problems 2022-can't download apps ...
Subscribe Here https://goo.gl/Qp13QnCamera used Canon T5i https://amzn.to/2FI0qcXGoogle playstore wont work fix, apps wont install fix and ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@daniel-stoneuk thanks for your help. Got it working now with the fragment.
Maybe you could mention in the readme to remove own contentViews like setcontentView in the Activity or the .inflate in the Fragment for this library to display its cards. Because when I removed the setContent it was working so I think that was the error.
Thanks again. Finally I can move on with my development 😉
ok I will try it now: No 1 is not working as I get this log E/RecyclerView: No adapter attached; skipping layout
I will try No2 now and let you know how it goes soon