Tips horizontal scroll with textbox - java

I would like to make horizontal swipe scroll with images and text views on it, 3-4 views.
Like tips screen on applications.
But, don't know which component to use, I need something like tabs(3-4 different layouts) but I dont want to show tab menu up. Just full screen, few buttons down, and in middle textbox with tip(which i want to animate later), everything is same in every layout just different image and text.
No code here in question because i stuck on beginning and need few tips what to use or some linked tutorial.

Here is how you can do this.
<ViewFlipper
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/pro_flip"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
//put your child elements for first page on this layout
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
//put your child elements for second page on this layout
</LinearLayout>>
</ViewFlipper>
Content on the first layout will be visible to the user at first, when he swipes the next layout will be loaded.
ViewFlipper should be sufficient for simple content like you mentioned. If you want something more look into ViewPager.

Related

How I go on a next line when the layout ends in android studio?

Currently I have a view that look like this:
I have implemented to insert the view programmatically in a horizontally-oriented LinearLayout. And I don't want my last view item to be displayed like that at the end. I want the it to be shown in the next row instead.
And this is my xml code:
<LinearLayout
android:id="#+id/layout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintTop_toBottomOf="#id/layout0">
</LinearLayout>
I have also tried FlowLayout and GridLayout, but both of them seem do not work.

How to define custom margins to StepperLayout navigation buttons

I have a StepperLayout that displays a list of questions to the users. However, half of the "NEXT" navigation button is hidden after giving it a background color. I want to define custom margins and alignments to the navigation buttons. See the gif image below.
I have tried overriding the codes used for the NEXT and BACK button but that displays duplicate buttons. I have also tried adding some paddings to the StepperLayout but still, it didn't help.
<com.stepstone.stepper.StepperLayout 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:id="#+id/stepper"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:ms_activeStepColor="#color/stepper_btn_blue"
app:ms_nextButtonBackground="#color/stepper_btn_blue"
app:ms_backButtonColor="#000000"
app:ms_completeButtonColor="#color/colorWhite"
app:ms_completeButtonText="Finish"
app:ms_stepperType="tabs"
tools:theme="#style/AppTheme" />

Android: How can I let Cardviews overlap themselves inside a Recyclerview?

I have a RecyclerView and inside it I want to put CardViews. Now I want these CardViews to overlap themselves like inside a Stackview, but i cannot find a solution to let my view look like this.
The result should look like the reminder app from iOS (see the screenshot) or like a deck of cards. The user should be able to scroll through the cardviews and drag them on the position he wants them to have.
Does anyone have an idea how to solve this problem? Or is there any library that could help me to let my view look like this? I have already tried an custom ItemDecoration but only the visible items of the RecyclerView are shifted and so the RecyclerView has a wrong behavior on scrolling.
You can achieve overlapping of items by using negative bottom margins for your item layout. See the documentations for details.
For example:
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="-10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Test"/>
</android.support.v7.widget.CardView>

Android – How can I Move a Layout Partially Offscreen?

I am trying to make a sliding menu in an android application I am building for my school, and whenever I open the menu, the menu button, in addition to the other views I've tried, are scaled to fit in the remaining 25% of the layout still on the screen. So my question is, how can I disable this scaling so views can be moved offscreen along with their parent layout?
This is the XML file of the layout I am trying to move. It contains the misbehaving button:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="#drawable/background_color"/>
<ImageButton
android:id="#+id/menu_button"
android:layout_width="56dp"
android:layout_height="35dp"
android:layout_alignParentRight="true"
android:background="#drawable/menu_button"/>
</RelativeLayout>
This is what the menu looks like closed:
This is how it looks when opened:
And this is how I want it to be when opened. Notice the menu button has moved offscreen.
Any help is appreciated.
EDIT:
Although it may work for a single button, I do not want to make the views invisible, I would like to move them off the screen to the right. If, for example, I wanted to add a TextView that fills a horizontal row on the layout, the TextView would be scaled to 25% of the screen upon opening the menu. Instead, I want it to retain the size and shape of all views and make them move partially off screen.
When menu opens up, set the visibility of menu icon to GONE
icon.setVisibilty(View.GONE);
and when close , again set visibility of icon to VISIBLE.
icon.setVisibilty(View.VISIBLE);

Scrolling in a view containing a ListView (Android)

In one of my activities I am showing certain information and at the end I have a ListView.
So my layout looks a bit like:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="30dip"
>
...
<ListView android:id="#android:id/android:list" android:layout_width="wrap_content"
android:layout_height="fill_parent" />
</LinearLayout>
When I run the application in the emulator I see that the information before the list view is always shown in the screen and there is a vertical scroll for the ListView only.
Is there a way to change this scrolling behaviour ?. What I would like to have is a vertical scroll for all the information in the screen, not only at the level of the ListView.
I tried wrapping the LinearLayout with a ScrollView, with different combinations of the android:layout_height attribute for all the views involved but I did not get the effect that I was looking for. Besides, some people say that it is a pretty bad idea to wrap a ListView with a ScrollView :
Android ScrollView layout problem
Scrolling with Multiple ListViews for Android
Thanks for any other ideas.
I've not tried this, but you might want to look at you tube video:
Google I/O 2010 - The world of ListView
http://www.youtube.com/watch?v=wDBM6wVEO70
Starting at time 27:11, it talks about how to make info above and/or below a ListView scroll with the ListView. It refers to scrolling headers and footers, but it does say you can put anything you want in them.

Categories

Resources