For example, i have a scrollView and a LinearLayout within one of my XML files. The LinearLayout is a small bar at the bottom of the screen used as navigation (70dp high).
I want to make it so that if a user swipes up/down within this LinearLayout it will display another LinearLayout just beneath it. Sort of like an expanded menu.
I have the extended layout created and placed and the animations are working. But i can't get it to swipe up/down within the LinearLayout.
How do i do this? Thanks in advance!
EDIT: Code Example
This is an example of the XML
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/wv"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@+id/llSM"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="70dp"
android:id="@+id/llSM"
android:orientation="horizontal"
android:layout_above="@+id/llNav"
android:layout_alignWithParentIfMissing="true"
>
<ImageButton
android:id="@+id/bWebsite"
android:layout_width="70dp"
android:layout_height="70dp"
android:src="@drawable/nhome"
android:clickable="true"
android:scaleType="fitXY"
android:background="#FFFFFF"
android:layout_weight="1" />
<ImageButton
android:id="@+id/bShop"
android:layout_width="70dp"
android:layout_height="70dp"
android:src="@drawable/nhome"
android:clickable="true"
android:scaleType="fitXY"
android:background="#FFFFFF"
android:layout_weight="1" />
<ImageButton
android:id="@+id/bFacebook"
android:layout_width="70dp"
android:layout_height="70dp"
android:src="@drawable/nfacebook"
android:clickable="true"
android:scaleType="fitXY"
android:background="#FFFFFF"
android:layout_weight="1" />
</LinearLayout>
<LinearLayout
android:id="@+id/llNav"
android:layout_width="match_parent"
android:layout_height="70dp"
android:orientation="horizontal"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="false"
android:layout_alignParentTop="false"
android:layout_centerInParent="true"
android:gravity="bottom|center_horizontal"
>
<ImageButton
android:id="@+id/bHome"
android:layout_width="70dp"
android:layout_height="70dp"
android:src="@drawable/nhome"
android:clickable="true"
android:scaleType="fitXY"
android:background="#FFFFFF"
android:layout_weight="1"
/>
<ImageButton
android:id="@+id/bContact"
android:layout_width="70dp"
android:layout_height="70dp"
android:src="@drawable/ncontactus"
android:clickable="true"
android:layout_toRightOf="@+id/bHome"
android:background="#FFFFFF"
android:scaleType="fitXY"
android:layout_weight="1"
/>
<ImageButton
android:id="@+id/bBooking"
android:layout_width="70dp"
android:layout_height="70dp"
android:src="@drawable/onlinebooking"
android:clickable="true"
android:layout_toRightOf="@+id/bContact"
android:background="#FFFFFF"
android:scaleType="fitXY"
android:layout_weight="1"
/>
</LinearLayout>
And this is the Main example:
protected void onCreate(Bundle savedInstanceState) {
//Remove title bar
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_external);
ll = (LinearLayout) findViewById(R.id.llNav);
ll.setVisibility(View.GONE);
animUp = AnimationUtils.loadAnimation(this, R.anim.anim_up);
animDown = AnimationUtils.loadAnimation(this, R.anim.anim_down);
NavBar(); //This just loads the buttons and their intents
Links(); //This is for the second linear layout loading social media
myWebView.setWebViewClient(new WebViewClient());
myWebView.getSettings().setJavaScriptEnabled(true);
myWebView.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);
myWebView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
myWebView.loadUrl("url");
ll2 = (LinearLayout) findViewById(R.id.llSM);
ll2.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if(event.getAction() == MotionEvent.ACTION_DOWN){
startY = event.getY();
//hello you just touched me!!!
} else if(event.getAction() == MotionEvent.ACTION_UP) {
float endY = event.getY();
if ((endY < startY) && (a==0)) {
ll.setVisibility(View.VISIBLE);
ll.startAnimation(animUp);
a = a+1;
}
else {
if ((endY > startY) && (a>=1)){
ll.startAnimation(animDown);
ll.setVisibility(View.GONE);
a = 0;
}
}
}
return false;
}
});
}
The WebView scrolls within it so it will not work in there. I want to be able to swipe on the linearlayout labelled "llSM" to bring up the "llNav" bar just beneath it and push everything up. I also need to click the buttons on the "llSM" bar to navigate between different web views.