in Education by
In my layout I am trying to get the CirclePageIndicator to sit at the bottom of my image and for my image to be aligned at the top of the screen. Whatever I try it doesn't work. Here is how I want it to look like: What it ends up looking like is this Here is my code for this. And because it is a ViewPager I added the ability to scroll through each image. Here is the code for that. public class SectionsPagerAdapter extends FragmentPagerAdapter { private int[] Images = new int[] { R.drawable.homephoneicon1, R.drawable.homephoneicon2, R.drawable.homephoneicon3, R.drawable.homephoneicon4, R.drawable.homephoneicon5}; public SectionsPagerAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int position) { return SlideshowFragment.newInstance(Images[position]); } @Override public int getCount() { return NUM_SLIDES; } } Here is the Slideshow code public class SlideshowFragment extends Fragment { int imageResourceId; public static SlideshowFragment newInstance(int i) { SlideshowFragment fragment = new SlideshowFragment(); fragment.imageResourceId = i; return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) { ImageView image = new ImageView(getActivity()); image.setImageResource(imageResourceId); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT); LinearLayout layout = new LinearLayout(getActivity()); layout.setLayoutParams(new LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT)); layout.setGravity(Gravity.TOP); layout.addView(image, params); return layout; } } Thanks for any help! JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
Here is how I did it Code public static SlideshowFragment newInstance(int i) { SlideshowFragment fragment = new SlideshowFragment(); fragment.imageResourceId = i; return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) { ImageView image = new ImageView(getActivity()); image.setImageResource(imageResourceId); image.setScaleType(ImageView.ScaleType.FIT_XY); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT); RelativeLayout layout = new RelativeLayout(getActivity()); layout.setLayoutParams(new LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT)); layout.addView(image, params); return layout; } Layout

Related questions

0 votes
    I have a custom toast notification which has an image and text. The custom toast works fine however I ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 30, 2022 in Education by JackTerrance
0 votes
    I am newbie to android development and learning it to my own. I have a very strange problem of ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 18, 2022 in Education by JackTerrance
0 votes
    I am newbie to android development and learning it to my own. I have a very strange problem of ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 14, 2022 in Education by JackTerrance
0 votes
    I've created a searchable activity as described here: http://developer.android.com/guide/topics/search/ ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 28, 2022 in Education by JackTerrance
0 votes
    I am developing an application where in 1 part I want to add javascript into WebView.. But am not getting ... ; wb.getSettings().setPluginsEnabled(true); wb.loadUrl("javascript:...
asked Feb 19, 2022 in Education by JackTerrance
0 votes
    How can I use Viewpager Adapter Button into MainActivity? I am developing a quiz app and I am comparing ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
0 votes
    I have a ViewPager below an AppBarLayout (with a Toolbar and a TabLayout). I cannot understand why the ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 2, 2022 in Education by JackTerrance
0 votes
    Views are created on top of Materialized views a. False b. True...
asked Feb 19, 2023 in Technology by JackTerrance
0 votes
    I am trying to model the UX for search as follows: How can I shift the search bar to the top of ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Aug 1, 2022 in Education by JackTerrance
0 votes
    I am adding new record in grid like below var newRow = Ext.create(gridModel); rowEditPlugin.cancelEdit(); ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 12, 2022 in Education by JackTerrance
0 votes
    I'm reading the 14th chapter of Hands-On Machine Learning with Scikit-Learn and TensorFlow. It says: ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 10, 2022 in Education by JackTerrance
0 votes
    I'm writing here since I have a question about Mat Toolbar and Mat-sidenav from Angular Material. I' ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 14, 2022 in Education by JackTerrance
0 votes
    As I tried to add a video on my top-wrapper previously. (Thank you so much for those who leave ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 9, 2022 in Education by JackTerrance
0 votes
    I was wondering if there was a way (at least on Ubuntu, which I am using) to have Emacs "always ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 18, 2022 in Education by JackTerrance
0 votes
    I was wondering if there was a way (at least on Ubuntu, which I am using) to have Emacs "always ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 17, 2022 in Education by JackTerrance
...