Viewpager fragment doesn't running functionally - android

I am now trying to implement viewpager with fragment. Everything is cool except i got error ViewPager has not been bound.
Exception details are logged in Window > Show View > Error Log in xml graphical layout.
And Here's a screenshot of my application.
Does anyone know why there is not showing indicator line below title ?

I did this project by referring this: https://github.com/JakeWharton/Android-ViewPagerIndicator.
Go through that sample project. It will really helps you to solve your problem.

For the records, hope it saves someone some time:
The Indicator needs to be bound to the ViewPager, something like indicator.setViewPager(viewpager)
Without a theme, the ViewPagerIndicator will not work. If you don't want to use the default style, set the ViewPagerIndicator style only as described here

Issue has been solved by myself. All i need is just to add theme style android:theme="#style/Theme.PageIndicatorDefaults" in project manifest file.

Related

Tab layout tab does not change background color

Please help. Have already tried all existing solutions but it does not work.
There is the part of the code
tabLayout.getTabAt(2)?.customView?.setBackgroundColor(Color.parseColor("#000000"))
Instead of customView() use getCsutomView(). Code should be like:
tabLayout.getTabAt(2)?.getCustomView?.setBackgroundColor(Color.parseColor("#000000"))
This should fix your problem.

SlideMenu Above App Bar Android Studio

I have created a slideMenu & when i press the button to show my menu it shows above the App Bar instead of below it. I changed some of my xml props to see if i can fix it but so far no result
app_bar
app_bar_part_2
I think i know whats the problem you are facing, still i cant be sure without seeing your code.
so please try as follow,
changes need to be done in your activity xml inside NavigationView tag
android:fitsSystemWindows="false"
And check if you are having your theme set to AppTheme.NoActionBar change it to AppTheme
Hopefully this will solve your problem.

Can't add any items to activity_main.xml in Android Studio

In Android Studio, I can't add any items from Palette to activity_main.xml in Design view. It just won't let me drag and drop them. Any idea why this happens?
Here is the PrintScreen:
According to new design method followed in android studio for android development you cannot add any elements to the activity_main.xml. Rather you should add them to content_main.xml.
You can learn more about it from this answer.
You can stop it from happening.
Answered by BNK:
If you create a new project, you can choose Empty Activity template
instead of Blank Activity. If you create a new activity, you can
choose Empty Activity instead of Blank Activity too.
how do I create an Empty Activity with a Fragment?
You start by creating an activity using the "Empty Activity" template.
Then, add a fragment class yourself or possibly via New > Fragment.
Please understand that all of the "New >" options, for activities,
fragments, etc., are all driven by templates. Those templates do what
they do. If you do not want what they are generating, don't use them,
and add the classes, resources, manifest entries, and such yourself.
Personally, I almost never use those templates, because it's simpler
IMHO just to create it all yourself than to rip out all the stuff you
don't need that gets generated.
I had same problem. In the design page, I saw error message "Render Error..."
I click Android Studio->check for update->update and restart
After android studio update, the drag&drop from Palette to design page works.
Check ConstraintLayout properties:
layout width and layout height should be "match parent", not "wrap content".
It works for me.
While you have marked a witget the editor don't let you drag.

ViewPager with Parallax effect

I wanted to created ViewPager with Parallax effect in which will be indicator. I am just beginner so i tried to use this library form GitHub https://github.com/prolificinteractive/ParallaxPager
I did everything by instruction, but it didn't work. Can anyone explain me how to do it?
1. I added this project to my project.
2. I Used a ParallaxContainer in my main layout XML.
3. For each page i created new layout XML files as in instaction. I added this line for each of them xmlns:app="http://schemas.android.com/apk/res-auto" , but its mistake everywhere in which was word app. app:x_in="#dimen/parallax_speed_slow" etc. Mistake was like "Unexpected namespace prefic app found for tag ImageView"
4. Find the parallax container by ID, Specify whether the pager should loop (true means it will loop),Submit a Layout Inflater and list the layouts for each page (in order). Currently there must be at least 2 in this list (repeats allowed).
5. In this Activity i added this method attachBaseContext to as in instaction
At the end when i test it in emulatore nothing happened. What i missed to do. What`s wrong here? Another problem is indicator as you see. Can anyone show me how to make parallax effect in viewpager or you have another good examples?

remove blue lining in android application layout

I cant remove the blue line present in my android application that is found available in the snapshot ,aht the mouse points at.
Please tell me how can i remove it...
I am using action bar sherlock and fragment both in the app.So I used a Theme.Sherlock
Please help me
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); before
dialog.setContentView(R.layout.ur_layout);
It seems something you missed in use of sherlock library and once you are using that lib you dont need to apply theme to your xml file ,
you have not past your code so it would difficult to say what went wrong . here i can find the one answers related to your question https://stackoverflow.com/a/13640827/501483

Categories

Resources