How to manage grid-view with slider and banner - android

In my activity i need banner, grid-view and slider but the grid-view is not fit to screen after installing app into mobile please help me. here is my xml file.and also set scrollview to all contents in xml.I need output like this screenBut my screen display like this
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:custom="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="#+id/container_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<include
android:id="#+id/toolbar"
layout="#layout/toolbar" />
</LinearLayout>
<ViewFlipper
android:id="#+id/flipper1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:flipInterval="3000"
android:inAnimation="#android:anim/slide_in_left"
android:outAnimation="#android:anim/slide_out_right">
<ImageView
android:layout_width="match_parent"
android:layout_height="110dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="-9dp"
android:contentDescription="ImageOne"
android:src="#drawable/banners" />
<!-- <ImageView
android:src="#drawable/handmadeproducts"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="ImageTwo"
android:layout_gravity="center_horizontal"
/>-->
</ViewFlipper>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<GridView
android:id="#+id/grid"
android:layout_width="fill_parent"
android:layout_height="270dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_margin="30dp"
android:layout_marginTop="-10dp"
android:columnWidth="200dp"
android:gravity="center"
android:horizontalSpacing="25dp"
android:numColumns="3"
android:verticalSpacing="20dp" />
<android.support.v7.widget.RecyclerView
android:id="#+id/my_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:scrollbars="none" />
</LinearLayout>
</ScrollView>
</LinearLayout>
<FrameLayout
android:id="#+id/container_body"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<fragment
android:id="#+id/fragment_navigation_drawer"
android:name="com.dk.buyolx.activity.FragmentDrawer"
android:layout_width="#dimen/nav_drawer_width"
android:layout_height="match_parent"
android:layout_gravity="start"
app:layout="#layout/fragment_navigation_drawer"
tools:layout="#layout/fragment_navigation_drawer" />
</android.support.v4.widget.DrawerLayout>

Related

problem with listview in my Drawerlayout dont' scrolling

i can' scroll my listView in DrawerLayout.
mycode activity_main:
<androidx.drawerlayout.widget.DrawerLayout 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:layout_width="match_parent"
android:orientation="vertical"
android:id="#+id/drawerLayout"
tools:openDrawer="start"
android:fitsSystemWindows="true"
android:layout_height="match_parent"
tools:context=".activities.MapActivity">
<com.google.android.material.navigation.NavigationView
android:layout_width="match_parent"
android:id="#+id/navigationViewRight"
android:layout_marginTop="30dp"
android:layout_marginBottom="5dp"
android:layout_height="match_parent"
android:layout_gravity="end">
<include
layout="#layout/layout_evennements"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</com.google.android.material.navigation.NavigationView>
<com.google.android.material.navigation.NavigationView
android:layout_width="match_parent"
android:id="#+id/navigationViewLeft"
android:layout_marginTop="30dp"
android:layout_marginBottom="5dp"
android:layout_height="match_parent"
android:layout_gravity="start">
<include
layout="#layout/layout_balises"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</com.google.android.material.navigation.NavigationView>
</androidx.drawerlayout.widget.DrawerLayout >
my Layout_events code :
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:clickable="true"
android:id="#+id/layout_evennements"
android:theme="#style/Theme.GPRStest.NoActionBar"
android:layout_height="match_parent"
android:focusable="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="#+id/dashmap2"
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="#color/backgroundcolor"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="#drawable/ic_baseline_close_24"
android:layout_marginStart="15dp"
tools:ignore="ContentDescription" />
</LinearLayout>
<com.gabontech.gprstest.utils.ListViewForEmbeddingInScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<ListView
android:id="#+id/listview_evennements"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:layout_below="#id/dashmap2"
android:layout_marginRight="5dp"
android:choiceMode="singleChoice"
android:divider="#android:color/transparent"
android:dividerHeight="0dp"
android:listSelector="#BFB9AF" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_below="#id/listview_evennements"
android:layout_gravity="center"
android:background="#color/white"
android:orientation="horizontal">
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:id="#+id/rien_a_voir"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:visibility="gone"
android:gravity="center">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="#string/noEventsData"/>
</RelativeLayout>
</RelativeLayout>
i would like to scroll mylistView but it does not scrolling.i use api to fetch data and display them in my ListView. then onDrawerOpen, ListView shows data but not scrolling. hope someone may help and bring a hand on it.

How to start a recyclerview from below the toolbar

I have a toolbar and a recyclerview to show notification list when clicked on the badge on tool bar.but my recyclerview is overlapping the toolbar. I need the recycler to start below the toolbar so the user can close it by touching the badge again.how can I solve this problem, can anyone help out?
LAYOUT_FILE.xml
<android.support.v4.widget.DrawerLayout 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/dd_drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".NavigationDrawerActivity">
<LinearLayout
android:id="#+id/toollbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include layout="#layout/navigation_actionbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"></include>
<WebView
android:id="#+id/webViewID"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
<LinearLayout
android:id="#+id/left_drawer_parent"
android:layout_width="280dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_gravity="left|start">
<include
layout="#layout/drawer_header"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<android.support.v7.widget.RecyclerView
android:id="#+id/left_drawer"
android:layout_width="280dp"
android:layout_height="match_parent"
android:paddingRight="10dp"
android:layout_gravity="left|start"
android:background="#color/gray"
android:choiceMode="singleChoice"
android:divider="#null"
android:scrollbars="vertical"
app:layoutManager="android.support.v7.widget.LinearLayoutManager" />
</LinearLayout>
<RelativeLayout
android:id="#+id/rlNotificLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/black"
android:layout_alignParentTop="true"
android:layout_marginTop="50dp"
android:padding="7dp"
android:visibility="gone" >
<android.support.v7.widget.RecyclerView
android:id="#+id/listView_Notific_Link"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#c4c3bf"
android:scrollbars="vertical"
android:divider="#c4c3bf"
android:dividerHeight="7dp"
android:paddingRight="2dp"
android:paddingLeft="2dp"
android:paddingBottom="7dp"
/>
</RelativeLayout>
</android.support.v4.widget.DrawerLayout>
You should use constraint layout: check out documentation here
Here's a nefty workaround on that. Set a top margin on your recyclerview. Use the layout_marginTop property and set it to ?actionBarSize. It should begin its layout below the toolbar.
You should use
app:layout_behavior="#string/appbar_scrolling_view_behavior"
inside your recyclerview
Try putting layout to the top. Topmost layout goes bottom.
<android.support.v4.widget.DrawerLayout 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/dd_drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".NavigationDrawerActivity">
<LinearLayout
android:id="#+id/toollbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:id="#+id/rlNotificLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginTop="50dp"
android:background="#color/black"
android:padding="7dp"
android:visibility="gone">
<android.support.v7.widget.RecyclerView
android:id="#+id/listView_Notific_Link"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#c4c3bf"
android:divider="#c4c3bf"
android:dividerHeight="7dp"
android:paddingLeft="2dp"
android:paddingRight="2dp"
android:paddingBottom="7dp"
android:scrollbars="vertical" />
</RelativeLayout>
<include
layout="#layout/navigation_actionbar"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<WebView
android:id="#+id/webViewID"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
<LinearLayout
android:id="#+id/left_drawer_parent"
android:layout_width="280dp"
android:layout_height="match_parent"
android:layout_gravity="left|start"
android:orientation="vertical">
<include
layout="#layout/drawer_header"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<android.support.v7.widget.RecyclerView
android:id="#+id/left_drawer"
android:layout_width="280dp"
android:layout_height="match_parent"
android:layout_gravity="left|start"
android:background="#color/gray"
android:choiceMode="singleChoice"
android:divider="#null"
android:paddingRight="10dp"
android:scrollbars="vertical"
app:layoutManager="android.support.v7.widget.LinearLayoutManager" />
</LinearLayout>
</android.support.v4.widget.DrawerLayout>
You can use SlidingUpPanel layout.
https://github.com/umano/AndroidSlidingUpPanel

How to make a search box not scrolling over scrollview Android

In my home screen I want to add the search box with navigation drawer but I am not able to set the non scrollable edittext over scrollview.
Here is my Code
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:background="#ecedf1">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/viewpager"
android:layout_width="match_parent"
android:layout_height="#dimen/_200sdp" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="#dimen/_200sdp"
>
<EditText
android:layout_width="#dimen/_280sdp"
android:layout_centerHorizontal="true"
android:layout_marginTop="#dimen/_10sdp"
android:layout_height="#dimen/_40sdp"
android:text="fdgsdfhsfhsfghhsfhsfhf"
android:background="#drawable/customedittext"/>
</RelativeLayout>
<RelativeLayout
android:id="#+id/viewPagerIndicator"
android:layout_width="match_parent"
android:layout_height="25dp"
android:layout_marginTop="#dimen/_180sdp"
android:gravity="center">
<LinearLayout
android:id="#+id/viewPagerCountDots"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:gravity="center"
android:orientation="horizontal" />
</RelativeLayout>
<com.information.aanjana.aanjanainformation.NonScrollGridView
android:id="#+id/gv_android"
android:layout_width="#dimen/_299sdp"
android:layout_height="match_parent"
android:horizontalSpacing="8dp"
android:layout_centerHorizontal="true"
android:numColumns="2"
android:paddingLeft="#dimen/_4sdp"
android:paddingRight="#dimen/_4sdp"
android:layout_marginTop="#dimen/_220sdp"
android:verticalSpacing="8dp"/>
</RelativeLayout>
</ScrollView>
<android.support.design.widget.NavigationView
android:id="#+id/navigation_view"
android:layout_height="match_parent"
android:layout_width="#dimen/_170sdp"
android:layout_gravity="start"
app:menu="#menu/drawer"
/>
</android.support.v4.widget.DrawerLayout>
I want a edittext with navigation drawer which should be sticky and do not scroll with rest of the layout. How can I achive it.
What I want is explained in screenshot below:
Try my below code:
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:background="#ecedf1">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/viewpager"
android:layout_width="match_parent"
android:layout_height="#dimen/_200sdp" />
<RelativeLayout
android:id="#+id/viewPagerIndicator"
android:layout_width="match_parent"
android:layout_height="25dp"
android:layout_marginTop="#dimen/_180sdp"
android:gravity="center">
<LinearLayout
android:id="#+id/viewPagerCountDots"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:gravity="center"
android:orientation="horizontal" />
</RelativeLayout>
<com.information.aanjana.aanjanainformation.NonScrollGridView
android:id="#+id/gv_android"
android:layout_width="#dimen/_299sdp"
android:layout_height="match_parent"
android:horizontalSpacing="8dp"
android:layout_centerHorizontal="true"
android:numColumns="2"
android:paddingLeft="#dimen/_4sdp"
android:paddingRight="#dimen/_4sdp"
android:layout_marginTop="#dimen/_220sdp"
android:verticalSpacing="8dp"/>
</RelativeLayout>
</ScrollView>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="#dimen/_200sdp"
android:layout_alignParentTop="true"
>
<EditText
android:layout_width="#dimen/_280sdp"
android:layout_centerHorizontal="true"
android:layout_marginTop="#dimen/_10sdp"
android:layout_height="#dimen/_40sdp"
android:text="fdgsdfhsfhsfghhsfhsfhf"
android:background="#drawable/customedittext"/>
</RelativeLayout>
</RelativeLayout>
<android.support.design.widget.NavigationView
android:id="#+id/navigation_view"
android:layout_height="match_parent"
android:layout_width="#dimen/_170sdp"
android:layout_gravity="start"
app:menu="#menu/drawer"
/>
</android.support.v4.widget.DrawerLayout>
Here Only thing which I have changed is kept the editText outside the scrollView.
Why don't you try to put it out outside the ScrollView. Then just overlay it with a RelativeLayout and the gravity set to top. I can't run it now but in xml should look like something like this
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:background="#ecedf1">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/viewpager"
android:layout_width="match_parent"
android:layout_height="#dimen/_200sdp" />
<RelativeLayout
android:id="#+id/viewPagerIndicator"
android:layout_width="match_parent"
android:layout_height="25dp"
android:layout_marginTop="#dimen/_180sdp"
android:gravity="center">
<LinearLayout
android:id="#+id/viewPagerCountDots"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:gravity="center"
android:orientation="horizontal" />
</RelativeLayout>
<com.information.aanjana.aanjanainformation.NonScrollGridView
android:id="#+id/gv_android"
android:layout_width="#dimen/_299sdp"
android:layout_height="match_parent"
android:horizontalSpacing="8dp"
android:layout_centerHorizontal="true"
android:numColumns="2"
android:paddingLeft="#dimen/_4sdp"
android:paddingRight="#dimen/_4sdp"
android:layout_marginTop="#dimen/_220sdp"
android:verticalSpacing="8dp"/>
</RelativeLayout>
</ScrollView>
<!-- Here we add the layout outside the ScrollView -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="#dimen/_200sdp"
android:gravity="top"> <!-- GRAVITY ADJUST -->
<EditText
android:layout_width="#dimen/_280sdp"
android:layout_centerHorizontal="true"
android:layout_marginTop="#dimen/_10sdp"
android:layout_height="#dimen/_40sdp"
android:text="fdgsdfhsfhsfghhsfhsfhf"
android:background="#drawable/customedittext"/>
</RelativeLayout>
<android.support.design.widget.NavigationView
android:id="#+id/navigation_view"
android:layout_height="match_parent"
android:layout_width="#dimen/_170sdp"
android:layout_gravity="start"
app:menu="#menu/drawer"
/>
</android.support.v4.widget.DrawerLayout>
Hopefully, it runs smoothly and turns out helpful.

ListView overlaid by Toolbar in Android

I have the problem that my Toolbar overlaid my ListView.
short info: I've implemented a Navigation Drawer.
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/project_drawer"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
tools:ignore="MergeRootFrame">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal">
<android.support.v7.widget.Toolbar
android:id="#+id/listview_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:elevation="4dp"
android:theme="#style/ThemeOverlay.AppCompat.ActionBar" />
<android.support.v4.widget.SwipeRefreshLayout
android:id="#+id/swipe_to_refresh"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ListView
android:id="#+id/list"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:smoothScrollbar="true" />
</android.support.v4.widget.SwipeRefreshLayout>
<RelativeLayout
android:id="#+id/emptyProjects"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:orientation="vertical">
<TextView
android:id="#+id/listviewNoContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="Sie haben zur Zeit keine Aufgaben"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#a4a5ae" />
<Button
android:id="#+id/examplesbutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="40dp"
android:background="#color/kevox"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:text="Beispiele anfordern"
android:textColor="#android:color/white" />
</RelativeLayout>
</RelativeLayout>
</FrameLayout>
<ListView
android:id="#+id/navList"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#android:color/background_light"
android:choiceMode="singleChoice"
android:divider="#android:color/darker_gray"
android:dividerHeight="0dp" />
Can someone tell my what I do wrong?
Maybe it's the position in the XML?
Or do I choosed the wrong style?
I followed this Guide:
http://developer.android.com/training/appbar/setting-up.html
Add this line android:layout_below="#+id/container" I have add this .. check this
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/project_drawer"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
tools:ignore="MergeRootFrame">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal">
<android.support.v7.widget.Toolbar
android:id="#+id/listview_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:elevation="4dp"
android:theme="#style/ThemeOverlay.AppCompat.ActionBar" />
<android.support.v4.widget.SwipeRefreshLayout
android:id="#+id/swipe_to_refresh"
android:layout_width="wrap_content"
android:layout_below="#+id/listview_toolbar"
android:layout_height="wrap_content">
<ListView
android:id="#+id/list"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:smoothScrollbar="true" />
</android.support.v4.widget.SwipeRefreshLayout>
<RelativeLayout
android:id="#+id/emptyProjects"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:orientation="vertical">
<TextView
android:id="#+id/listviewNoContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="Sie haben zur Zeit keine Aufgaben"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#a4a5ae" />
<Button
android:id="#+id/examplesbutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="40dp"
android:background="#color/boxcolor"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:text="Beispiele anfordern"
android:textColor="#android:color/white" />
</RelativeLayout>
</RelativeLayout>
</FrameLayout>
<ListView
android:id="#+id/navList"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#android:color/background_light"
android:choiceMode="singleChoice"
android:divider="#android:color/darker_gray"
android:dividerHeight="0dp" />
</android.support.v4.widget.DrawerLayout>

WebView content (website) at Android device to large

I crated an Android app with webview. In Android simulator I can scroll out the website, till it match perfekt the webview. But at a real Android device, I'm not able to scroll out till the website content matches the webwiew, it is to large. What co do I have to put/change to get the website match the webview?
I hope you understand my issue und can help me!?
this.mWebView.getSettings().setJavaScriptEnabled(true);
this.mWebView.getSettings().setUseWideViewPort(true);
this.mWebView.getSettings().setLoadWithOverviewMode(true);
this.mWebView.getSettings().setRenderPriority(RenderPriority.HIGH);
if you mention above settings ,webview can render your website properly.
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:webviewapp="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/container_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v4.widget.SwipeRefreshLayout
android:id="#+id/container_swipe_refresh"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<WebView
android:id="#+id/fragment_main_webview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/global_bg_front" />
</android.support.v4.widget.SwipeRefreshLayout>
<com.google.android.gms.ads.AdView
android:id="#+id/fragment_main_adview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
webviewapp:adUnitId="#string/admob_unit_id"
webviewapp:adSize="BANNER" />
</LinearLayout>
<include layout="#layout/placeholder_progress"
android:id="#+id/container_progress"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
<include layout="#layout/placeholder_offline"
android:id="#+id/container_offline"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
<include layout="#layout/placeholder_empty"
android:id="#+id/container_empty"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
</FrameLayout>
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:webviewapp="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/container_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v4.widget.SwipeRefreshLayout
android:id="#+id/container_swipe_refresh"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<WebView
android:id="#+id/fragment_main_webview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/global_bg_front" />
</android.support.v4.widget.SwipeRefreshLayout>
<com.google.android.gms.ads.AdView
android:id="#+id/fragment_main_adview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
webviewapp:adUnitId="#string/admob_unit_id"
webviewapp:adSize="BANNER" />
</LinearLayout>
<include layout="#layout/placeholder_progress"
android:id="#+id/container_progress"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
<include layout="#layout/placeholder_offline"
android:id="#+id/container_offline"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
<include layout="#layout/placeholder_empty"
android:id="#+id/container_empty"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
</FrameLayout>
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/activity_main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="#+id/activity_main_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ListView
android:id="#+id/activity_main_drawer"
android:layout_width="#dimen/drawer_width"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:drawSelectorOnTop="false"
android:fastScrollEnabled="false"
android:dividerHeight="#dimen/drawer_item_divider"
android:divider="#color/drawer_item_divider"
android:cacheColorHint="#android:color/transparent"
android:listSelector="#android:color/transparent"
android:background="#color/drawer_bg" />
</android.support.v4.widget.DrawerLayout>

Categories

Resources