ScrollView with ViewPager can't scroll xml file in that ViewPager - android

I have a ScrollView in that I have a ViewPager with a PagerSlidingTabStrip. In the ViewPager I have a xml file which contains some TextViews with long texts in it. The problem is that the scrollview don't scroll to the end where the last TextViews are of the second xml file are.
First xml with viewPager:
<LinearLayout 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/recipe_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ScrollView
android:id="#+id/scrollView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="5.80" >
<LinearLayout
android:id="#+id/recipe_linearLayout_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:background="#android:color/background_light"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="500dp"
android:layout_marginTop="5dp"
android:layout_weight="18"
android:orientation="vertical" >
<com.astuetz.PagerSlidingTabStrip
android:id="#+id/tabs"
android:layout_width="match_parent"
android:layout_height="48dip"
android:background="#drawable/background_tabs" >
</com.astuetz.PagerSlidingTabStrip>
<android.support.v4.view.ViewPager
android:id="#+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
</android.support.v4.view.ViewPager>
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
Second xml file with the TextViews:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/tools"
android:id="#+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ScrollView
android:id="#+id/scrollView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="5.80" >
<LinearLayout
android:id="#+id/recipe_linearLayout_desc"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:background="#android:color/background_light"
android:orientation="vertical" >
<TextView
android:id="#+id/textView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:background="#color/red"
android:gravity="center"
android:text="INGREDIENTS"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/white" />
<LinearLayout
android:id="#+id/ingLinearLayout"
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView1"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:background="#color/white"
android:orientation="vertical" >
<TextView
android:id="#+id/ingTV"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_weight="0.11"
android:maxLines="20"
android:singleLine="false"
android:text="#string/verylongtext"
android:textColor="#color/black" />
</LinearLayout>
<TextView
android:id="#+id/TextView01"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/ingLinearLayout"
android:background="#color/red"
android:gravity="center"
android:text="DESCRIPTION"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/white" />
<LinearLayout
android:id="#+id/descLinearLayout"
android:layout_width="match_parent"
android:layout_height="180dp"
android:layout_below="#+id/TextView01"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:background="#color/white"
android:orientation="vertical" >
<TextView
android:id="#+id/descTV"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_weight="0.11"
android:maxLines="20"
android:singleLine="false"
android:text="#string/verylongtext"
android:textColor="#color/black" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
This is how it looks when I scroll to the bottom:
And this is how it should look:
I can not find out why it cuts the view and why is it not possible to scroll down until the whole second xml file is displayed?
I am using this ViewPager lib: github.com/astuetz/ViewPagerExtensions

Related

trying to position my checkbox above the keyboard in XML

My activity looks like this:
I use this XML :
<LinearLayout 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:orientation="vertical"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<SearchView
android:layout_width="0px"
android:layout_height="wrap_content"
android:background="#5b74a8"
android:padding="4dp"
android:id="#+id/searchView"
android:singleLine="true"
android:layout_gravity="right"
android:layout_weight="7">
</SearchView>
<ImageButton
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:id="#+id/settingsButton"
android:src="#drawable/settingsicon"
android:background="#drawable/ambuttonstatessettings"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:onClick="settingsPopUp"
/>
</LinearLayout>
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/contacts_list"></ListView>
</LinearLayout>
But I want it to look like this, with a checkbox above the keyboard. Or if the keyboard is not there, the checkbox should be at the bottom :
Any idea how I can do this ? I tried this code, which is the closest I've come (basically, making a new linear layout at the bottom) but I can't get it right. And can't figure out why.
<LinearLayout 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:orientation="vertical"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<SearchView
android:layout_width="0px"
android:layout_height="wrap_content"
android:background="#5b74a8"
android:padding="4dp"
android:id="#+id/searchView"
android:singleLine="true"
android:layout_gravity="right"
android:layout_weight="7">
</SearchView>
<!--android:drawableLeft="#android:drawable/ic_menu_search"-->
<!--android:queryHint="howdy"-->
<ImageButton
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:id="#+id/settingsButton"
android:src="#drawable/settingsicon"
android:background="#drawable/ambuttonstatessettings"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:onClick="settingsPopUp"
/>
</LinearLayout>
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/contacts_list"></ListView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:orientation="horizontal" >
<CheckBox
android:layout_height="match_parent"
android:layout_width="0dp"
android:background="#ffa500"
android:text="New CheckBox"
android:id="#+id/checkBox"
android:layout_weight="1"
/>
</LinearLayout>
</LinearLayout>
try this:
<LinearLayout
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:orientation="vertical"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<SearchView
android:layout_width="0px"
android:layout_height="wrap_content"
android:background="#5b74a8"
android:padding="4dp"
android:id="#+id/searchView"
android:singleLine="true"
android:layout_gravity="right"
android:layout_weight="7"/>
<!--android:drawableLeft="#android:drawable/ic_menu_search"-->
<!--android:queryHint="howdy"-->
<ImageButton
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:id="#+id/settingsButton"
android:background="#787878"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:onClick="settingsPopUp"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="100">
<ListView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="80"
android:id="#+id/contacts_list"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_weight="20"
android:orientation="horizontal" >
<CheckBox
android:layout_height="match_parent"
android:layout_width="0dp"
android:background="#ffa500"
android:text="New CheckBox"
android:id="#+id/checkBox"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
this is the solution.

Vertical scroll view showing Horizontal effect .Why?

In my XML i have a relative layout having vertical orientation ,it has some child views.I have added a vertical scroll view for this relative layout.But it shows a horizontal effect.I could not understand the problem can anyone help ,Here is my XML .
<VerticalScrollView android:id="#+id/vertical_scroll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none"
xmlns:android="http://schemas.android.com/apk/res/android">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/popup_element"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f6f5f3"
android:orientation="vertical">
<TextView
android:id="#+id/previewText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/your_text_preview"
android:textSize="40sp"
android:layout_centerHorizontal="true" />
<android.support.design.widget.TextInputLayout
android:id="#+id/textContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="80dp"
app:counterEnabled="true"
app:counterMaxLength="50"
>
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/textInputEditText"
android:layout_below="#id/previewText"
android:layout_margin="20dp"
android:maxLength="50"
android:ems="10"
android:hint="#string/enter_text_here"/>
</android.support.design.widget.TextInputLayout>
<HorizontalScrollView
android:id="#+id/fontArea"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/textContainer"
android:scrollbars="none" >
<LinearLayout
android:id="#+id/fonts"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
</LinearLayout>
</HorizontalScrollView>
<HorizontalScrollView
android:id="#+id/colorArea"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/fontArea"
android:scrollbars="none" >
<LinearLayout
android:id="#+id/colors"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
</LinearLayout>
</HorizontalScrollView>
<CheckedTextView
android:id="#+id/shadowCheck"
android:layout_below="#id/colorArea"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:padding="12dp"
android:checkMark="?android:attr/listChoiceIndicatorMultiple"
android:text="#string/shadow"
android:checked="true" />
<Button
android:id="#+id/done"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/apply"
android:layout_below="#+id/shadowCheck"
android:layout_alignRight="#+id/previewText"
android:layout_alignEnd="#+id/previewText"
android:layout_marginTop="94dp" />
</RelativeLayout>
</VerticalScrollView>
try this changes:
<ScrollView
android:id="#+id/vertical_scroll"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none">
<LinearLayout
android:id="#+id/popup_element"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f6f5f3"
android:orientation="vertical">
<TextView
android:id="#+id/previewText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="#string/your_text_preview"
android:textSize="40sp"/>
<android.support.design.widget.TextInputLayout
android:id="#+id/textContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="80dp"
app:counterEnabled="true"
app:counterMaxLength="50">
<android.support.design.widget.TextInputEditText
android:id="#+id/textInputEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/previewText"
android:layout_margin="20dp"
android:ems="10"
android:hint="#string/enter_text_here"
android:maxLength="50"/>
</android.support.design.widget.TextInputLayout>
<HorizontalScrollView
android:id="#+id/fontArea"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/textContainer"
android:scrollbars="none">
<LinearLayout
android:id="#+id/fonts"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
</LinearLayout>
</HorizontalScrollView>
<HorizontalScrollView
android:id="#+id/colorArea"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/fontArea"
android:scrollbars="none">
<LinearLayout
android:id="#+id/colors"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
</LinearLayout>
</HorizontalScrollView>
<CheckedTextView
android:id="#+id/shadowCheck"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/colorArea"
android:checkMark="?android:attr/listChoiceIndicatorMultiple"
android:checked="true"
android:gravity="center_vertical"
android:padding="12dp"
android:text="#string/shadow"/>
<Button
android:id="#+id/done"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/previewText"
android:layout_alignRight="#+id/previewText"
android:layout_below="#+id/shadowCheck"
android:layout_marginTop="94dp"
android:text="#string/apply"/>
</LinearLayout>
</ScrollView>

Expandable Gridview is not showing the full content

I am using Expandable GridView which doesn't scroll the whole content if grid items are changed dynamically.
Below is the xml code for main gridview
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="135dp">
<android.support.v4.view.ViewPager
android:id="#+id/pager1"
android:layout_width="match_parent"
android:layout_height="135dp"
android:layout_above="#+id/titles"
android:overScrollMode="never">
</android.support.v4.view.ViewPager>
<com.viewpagerindicator.CirclePageIndicator
android:id="#+id/titles"
style="#style/CustomCirclePageIndicator"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:padding="5dp" />
</RelativeLayout>
<fone.adipoli.shopping.ExpandableHeightGridView
android:id="#+id/gridView_shopping"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fff"
android:focusable="true"
android:focusableInTouchMode="true"
android:gravity="center"
android:horizontalSpacing="0dp"
android:listSelector="#android:color/transparent"
android:numColumns="2"
android:stretchMode="columnWidth"
android:verticalSpacing="0dp" />
</LinearLayout>
Xml for each Grid item
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#android:color/white"
android:orientation="vertical">
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="#+id/cardrow1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
card_view:cardCornerRadius="3dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_gravity="center">
<ImageView
android:id="#+id/img_grid_row1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
/>
</LinearLayout>
<TextView
android:id="#+id/grid_row1_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text=""
/>
<TextView
android:id="#+id/grid_row1_model"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text=""
android:textAppearance="?android:attr/textAppearanceSmall"
android:visibility="gone" />
<TextView
android:id="#+id/grid_row1_price_offr"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text=""
android:textAppearance="?android:attr/textAppearanceSmall"
/>
<TextView
android:id="#+id/grid_row1_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text=""
android:textSize="10sp"
/>
<TextView
android:id="#+id/grid_row1_product"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text=""
android:textSize="10sp"
android:visibility="gone"
/>
<TextView
android:id="#+id/buy_grid"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="2dp"
android:text="BUY"
android:padding="10dp"
android:gravity="center"
android:textColor="#color/white"
android:background="#color/blue"
android:textAppearance="? android:attr/textAppearanceSmall"/>
</LinearLayout>
</android.support.v7.widget.CardView>
I tried adding a view in the bottom after GridView ,but it doesn't work out.
Any help would be really thankfull.
Use android.support.v4.widget.NestedScrollView
or
ScrollView
Put your whole Grid items in NestedScrollView, or ScrollView seems to solve your problem.

Android map with custom layout

I' am trying to achieve sth like this:
But the ListView is overlaps my bottom bar. What is the best way to prevent such a behaviour? As you can see in the picture there is a map under bottom bar. This bottom bar is like target/destination window in Google Maps app.
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<com.google.android.gms.maps.MapView
android:id="#+id/map"
tools:layout="#layout/fragmentMap"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp"
android:layout_marginTop="2dp"
android:orientation="vertical">
<EditText
android:id="#+id/mapEditT"
android:layout_width="fill_parent"
android:layout_height="53dp"
android:layout_alignParentTop="true"
android:gravity="center|left"
android:paddingLeft="2dp"
android:paddingRight="0dp"/>
<ListView
android:id="#+id/listVi"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#android:color/white"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:orientation="vertical">
<ImageButton
android:id="#+id/draweR"
android:layout_width="wrap_content"
android:src="#drawable/draweR"/>
<LinearLayout
android:id="#+id/infoBox"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_marginTop="40dp"
android:alpha="0.1"
android:background="#android:color/black"
android:orientation="horizontal">
<TextView
android:id="#+id/text2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="20dp"
android:text="Info"
/>
<TextView
android:id="#+id/text3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_toRightOf="#id/text2"
android:text="Info/>
</LinearLayout>
</LinearLayout>
</FrameLayout>
Use LinearLayout or RelativeLayout as top most parent instead of FrameLayout.
Here is the code snippet using LinearLayout.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<EditText
android:id="#+id/textView1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_vertical" />
<Button
android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
</LinearLayout>
<ListView
android:id="#+id/listView1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" >
</ListView>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ImageButton
android:id="#+id/draweR"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="left|center_vertical"
android:src="#drawable/draweR"/>
<com.google.android.gms.maps.MapView
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:layout="#layout/fragmentMap" />
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="100" >
<TextView
android:id="#+id/textView2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="TextView"
android:layout_weight="75" />
<TextView
android:id="#+id/textView3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="TextView"
android:layout_weight="25" />
</LinearLayout>
</LinearLayout>
You can mess around with the margins. I got it to look like the image you wanted.
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<com.google.android.gms.maps.MapView
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:layout="#layout/fragmentMap" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp"
android:layout_marginTop="2dp"
android:orientation="vertical"
android:paddingBottom="160dp" >
<EditText
android:id="#+id/mapEditT"
android:layout_width="fill_parent"
android:layout_height="53dp"
android:layout_alignParentTop="true"
android:gravity="center|left"
android:paddingLeft="2dp"
android:paddingRight="0dp" />
<ListView
android:id="#+id/listVi"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#android:color/white" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:orientation="vertical" >
<ImageButton
android:id="#+id/draweR"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/draweR" />
<LinearLayout
android:id="#+id/infoBox"
android:layout_width="match_parent"
android:layout_height="100dp"
android:alpha="0.1"
android:background="#android:color/black"
android:orientation="horizontal" >
<TextView
android:id="#+id/text2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="20dp"
android:text="Info" />
<TextView
android:id="#+id/text3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_toRightOf="#id/text2"
android:text="Info" />
</LinearLayout>
</LinearLayout>

How display a LinearLayout above a FrameLayout?

My code XML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#777777"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="30dip"
android:layout_alignParentTop="true"
android:gravity="left|bottom"
android:orientation="horizontal" >
<TextView
android:id="#+id/txtTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="00:00:00"
android:textColor="#ffffff" />
</LinearLayout>
<FrameLayout
android:id="#+id/camera_preview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="110dp"
android:background="#000000" >
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_alignParentBottom="true"
android:gravity="center|top"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:gravity="center"
android:orientation="horizontal" >
<Button
android:id="#+id/button_Rotation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#drawable/my_progress_interminate" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
How display TextView txtTime above FrameLayout the same button button_Rotation?
I had fixed by move layout contain TextView down to under Framelayout:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#777777"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<FrameLayout
android:id="#+id/camera_preview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="110dp"
android:background="#000000" >
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="30dip"
android:layout_alignParentTop="true"
android:gravity="left|bottom"
android:orientation="horizontal" >
<TextView
android:id="#+id/txtTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="00:00:00"
android:textColor="#ffffff" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_alignParentBottom="true"
android:gravity="center|top"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:gravity="center"
android:orientation="horizontal" >
<Button
android:id="#+id/button_Rotation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#drawable/my_progress_interminate" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
outter linearLayout unless, then in your RelativeLayout
1st RelativeLayou: android:layout_alignParentTop="true", and set an id(#+id/rl)
2nd FrameLayout: android:layout_below="#id/rl"
3rd LinearLayout: android:layout_below="#id/camera_view"
That's all! Good luck!
It is the easiest way to do it:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<FrameLayout
android:id="#+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FAFFD5" >
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="90dp"
android:layout_alignParentBottom="true"
android:gravity="center"
android:orientation="vertical"
android:background="#drawable/textlayout_outline"
android:layout_margin="50dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/are_you_looking_for_something" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/tap_here" />
</LinearLayout>

Categories

Resources