Programmatically add visible views to Android textureview - java

I want to know if it's possible to programmatically add a view to the texture view (camera2).
If I add the texture view to a frame layout which has a view in it, then that view is not visible.

Related

View Pager and Gridview wrap_content

I have custom view with extends LinearLayout. Custom view is viewpager with grid view inside. I add "wrap_content" wherever possible, but my view spend whole screen or only one grid's view line.
I find examples GridView with wrap_content function, but it is not help me

Android animation in a recycler view to change bounds?

I have a recycler view and the rows in each recycler view can have varying size depending on information inside them which is dynamically filled into it.
Now when I scroll the recycler view the layout gets inflated and there is a sudden jerk in the screen. So i want to animate this part where i can just expand the lower bound of the row or any other method suitable.
How do i animate just the lower bound?? please help..
i have used this code
int height = holder.customLayout.getHeight();
holder.customLayout.animate().translationY(height).setDuration(1000);
but it messes up with entire view

Combine Vertical scoll view of parent layout and contents of view pager

I have a 'page' that has a number of components on it, and who's content is longer than the height of the device. one of the component is view pager. Content of view pager is also very large. How can i combine vertical scroll view of parent layout and view pager layout.My laytout is as follows:
few components
view pager-(large content in another layout)
few more component
i want to combine scroll view of view pager and parent layout
It should just work. See here -> ViewPager inside a ScrollView does not scroll correclty
You structure should be like this:
ScrollView
-ViewPager
--ScrollView
Then just apply the suggestions made in the linked post above.
Also make sure the ViewPager has a fixed height! Otherwise the ScrollView inside the ViewPager won't work without writing a custom ScrollView or ViewPager.

Off set android view while using android:layout_centerVertical="true"?

I'm trying to get a view center vertically in android, but I have a imageView at the top that is 75dps, so I need my centered view to be offset from the top by 75dps so it gets centered! Is there a way to do this? I tried using android:layout_marginTop="75dp" but it didn't work! Any ideas?
You could wrap your view into a ViewGroup (e.g. LinearLayout), then make the LinearLayout centered, and add the marginTop to your view. It should work.
Anyway, it would be helpful if you post also your layout xml.

ViewPager with ImageViews having pinch-zoom and gestures capabilities - view reuse issue

I have a ViewPager with custom ImageView-based class as ViewPager childrens. In my ImageView I have implemnted gesture handling - pinch and 2-finger zoom and image move. Now my problem is that ViewPager reuses view and there is no mechanism for saving particular view state of child views. In my case it results in following - user zooms and/or moves image on particular ImageView, then ViewAdapter reuses view for current view and the image gets display with default scale/position. I wonder how to save the view state so that after view reuse I can load the last state of view to have the correct zoom/move state.
Does anybody have some hints?
Maybe you should use setTag and save the state of the modified child view. If getTag is not null, you can restore the state of the child.

Categories