How to configure the layout so that the output will be output on the listview below the input search - xamarin.android

I have created a design with the following source axml:
when the listview output is shown getting data from the sqllite database the listview will overlap the test textview,edittext as below:
Required Output Result Listview should be below as shown below:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:background="#ffffff"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:text="#string/test"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_width="87.5dp"
android:layout_height="wrap_content"
android:id="#+id/test"
android:textColor="#android:color/black" />
<EditText
android:id="#+id/test_input"
android:layout_height="wrap_content"
android:layout_width="152.0dp"
android:inputType="text"
android:layout_toRightOf="#+id/test" />
<Button
android:id="#+id/MyButton"
android:layout_width="128.5dp"
android:layout_height="wrap_content"
android:text="#string/ButtonClick"
android:layout_toRightOf="#+id/test_input" />
<ListView
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/listtable"
android:layout_alignBottom="#+id/MyButton" />
</RelativeLayout>

Assuming you are using the Appcompat Library i would do the following changes to your layout :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:background="#ffffff"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:orientation="horizontal"
android:id="#+id/LinearContent"
android:layout_alignParentTop="true"
android:layout_height="wrap_content">
<TextView
android:text="Test"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_width="87.5dp"
android:layout_height="wrap_content"
android:id="#+id/test"
android:textColor="#android:color/black" />
<EditText
android:id="#+id/test_input"
android:layout_height="wrap_content"
android:layout_width="152.0dp"
android:inputType="text"
android:layout_toRightOf="#+id/test" />
<Button
android:id="#+id/MyButton"
android:layout_width="128.5dp"
android:layout_height="wrap_content"
android:text="Search"
android:layout_toRightOf="#+id/test_input" />
</android.support.v7.widget.LinearLayoutCompat>
<android.support.v7.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_below="#id/LinearContent"
android:layout_height="wrap_content">
<ListView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/listtable"
/>
</android.support.v7.widget.LinearLayoutCompat>
Revert in case it doesn't work

Solved.
Change the properties of list view with the following:
android:layout_alignBottom to
android:layout_below

Related

Android UI cordinator layout or nested scroll view issue

I am using a nested scrollview in CoordinatorLayout I have different horizontal cords which are stacked in nested scrollview . I am unable to fix the space which is not required (I have added blue color to the space).
Anybody any fix or what am I doing wrong?
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:fresco="http://schemas.android.com/tools"
android:id="#+id/cordinator_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#00f"
app:layout_scrollFlags="scroll|enterAlways">
<android.support.design.widget.AppBarLayout
android:id="#+id/appBar"
android:layout_width="match_parent"
android:layout_height="300dp"
android:fitsSystemWindows="true"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="#+id/collapsingToolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginEnd="64dp"
app:expandedTitleMarginStart="48dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<com.facebook.drawee.view.SimpleDraweeView
android:id="#+id/movie_poster"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:fitsSystemWindows="true"
android:scaleType="centerCrop"
app:layout_collapseMode="pin"
fresco:placeholderImage="#drawable/placeholder" />
<android.support.design.widget.TabLayout
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_gravity="bottom"
app:tabContentStart="72dp"
app:tabMode="scrollable" />
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#id/appBar"
android:fitsSystemWindows="true"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#0f0"
android:orientation="vertical">
<android.support.v7.widget.CardView
android:id="#+id/info_card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/plot_synopsis"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/cardview_dark_background"
android:maxLines="4"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:textColor="#fff"
android:textSize="21sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/cardview_dark_background"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:baselineAligned="false"
android:orientation="vertical"
android:padding="10dp"
android:weightSum="4">
<TextView
android:id="#+id/release_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#fff"
android:textSize="20sp" />
<TextView
android:id="#+id/vote"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#fff"
android:textSize="20sp" />
</LinearLayout>
<Button
android:id="#+id/b11"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/fav" />
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
<LinearLayout
android:id="#+id/nextAirLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:background="#color/cardview_dark_background"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="#string/next_episode"
android:textColor="#fff"
android:textStyle="bold" />
<include
layout="#layout/episode_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
<include
android:id="#+id/tvSeasonsCard"
layout="#layout/image_card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp" />
<include
android:id="#+id/tvCastCard"
layout="#layout/image_card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp" />
<include
android:id="#+id/videosCard"
layout="#layout/image_card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp" />
<include
android:id="#+id/similarTvShowsCard"
layout="#layout/image_card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp" />
<include
android:id="#+id/recommendedTvShowsCard"
layout="#layout/image_card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>

Scrollview autoscroll with enter key in editext android

I have a layout in which I have 4 edittext in nestedscrollview
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout 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:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="#android:color/white"
>
<TextView
android:id="#+id/back"
android:layout_width="50dp"
android:layout_height="50dp"
android:textColor="#android:color/black"
android:textSize="17sp"
android:background="#drawable/logo" />
<TextView
android:id="#+id/toolbar_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textColor="#android:color/black"
android:textSize="17sp" />
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView 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/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:scrollbars="vertical"
android:focusable="true"
android:focusableInTouchMode="true"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:context="labs108.com.dentalstudent.activity.MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:layout_marginBottom="30dp"
android:orientation="vertical">
<TextView
android:id="#id/name"
android:layout_marginTop="5dp"
android:text="#string/mayank_agrawal"
android:textSize="17sp"
android:textStyle="bold"
android:textDirection="ltr"
android:gravity="center_horizontal"
android:textColor="#android:color/black"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/mobile"
android:layout_marginTop="5dp"
android:text="#string/mobile_no"
android:textSize="14sp"
android:textDirection="ltr"
android:gravity="center_horizontal"
android:textColor="#android:color/holo_green_light"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/gender"
android:layout_marginTop="5dp"
android:text="#string/gender_text"
android:textSize="14sp"
android:textStyle="bold"
android:textDirection="ltr"
android:gravity="center_horizontal"
android:textColor="#android:color/holo_green_light"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/age"
android:layout_marginTop="5dp"
android:text="#string/age_text"
android:textSize="14sp"
android:textDirection="ltr"
android:textStyle="bold"
android:gravity="center_horizontal"
android:textColor="#android:color/holo_green_light"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/date"
android:layout_marginTop="5dp"
android:text="#string/date"
android:textSize="14sp"
android:textDirection="ltr"
android:textStyle="bold"
android:gravity="center_horizontal"
android:textColor="#android:color/holo_green_light"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/explain"
android:layout_marginTop="5dp"
android:text="#string/explain"
android:textSize="14sp"
android:textDirection="ltr"
android:textStyle="bold"
android:gravity="center_horizontal"
android:textColor="#android:color/holo_green_light"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/complain"
android:layout_marginTop="5dp"
android:text="#string/complain_text"
android:textSize="14sp"
android:textDirection="ltr"
android:textStyle="bold"
android:gravity="center_horizontal"
android:textColor="#android:color/holo_green_light"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:layout_marginTop="10dp"
android:text="#string/upload_pic"
android:textSize="14sp"
android:gravity="center_horizontal"
android:textDirection="ltr"
android:textColor="#android:color/black"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ProgressBar
android:id="#+id/progressbar1"
android:layout_centerInParent="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="?android:attr/progressBarStyleLarge" />
<ImageView
android:layout_marginTop="20dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:id="#+id/pic1"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:layout_gravity="center_horizontal"
android:layout_width="350dp"
android:layout_height="200dp" />
</RelativeLayout>
<TextView
android:gravity="center_horizontal"
android:id="#+id/show1"
android:text="Show Pic"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<EditText
android:id="#+id/edit1"
android:layout_marginTop="30dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
android:gravity="start"
android:textDirection="anyRtl"
android:scrollbars="vertical"
android:textAlignment="viewStart"
android:background="#android:drawable/editbox_background_normal"
android:layout_width="match_parent"
android:layout_height="150dp" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ProgressBar
android:id="#+id/progressbar2"
android:layout_centerInParent="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="?android:attr/progressBarStyleLarge" />
<ImageView
android:layout_marginTop="20dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:id="#+id/pic2"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:layout_gravity="center_horizontal"
android:layout_width="350dp"
android:layout_height="200dp" />
</RelativeLayout>
<TextView
android:gravity="center_horizontal"
android:id="#+id/show2"
android:text="Show Pic"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<EditText
android:id="#+id/edit2"
android:layout_marginTop="30dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
android:gravity="start"
android:textDirection="anyRtl"
android:scrollbars="vertical"
android:textAlignment="viewStart"
android:background="#android:drawable/editbox_background_normal"
android:layout_width="match_parent"
android:layout_height="150dp" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ProgressBar
android:id="#+id/progressbar3"
android:layout_centerInParent="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="?android:attr/progressBarStyleLarge" />
<ImageView
android:layout_marginTop="20dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:id="#+id/pic3"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:layout_gravity="center_horizontal"
android:layout_width="350dp"
android:layout_height="200dp" />
</RelativeLayout>
<TextView
android:gravity="center_horizontal"
android:id="#+id/show3"
android:text="Show Pic"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<EditText
android:id="#+id/edit3"
android:layout_marginTop="30dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
android:gravity="start"
android:textDirection="anyRtl"
android:scrollbars="vertical"
android:textAlignment="viewStart"
android:background="#android:drawable/editbox_background_normal"
android:layout_width="match_parent"
android:layout_height="150dp" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ProgressBar
android:id="#+id/progressbar4"
android:layout_centerInParent="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="?android:attr/progressBarStyleLarge" />
<ImageView
android:layout_marginTop="20dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:id="#+id/pic4"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:layout_gravity="center_horizontal"
android:layout_width="350dp"
android:layout_height="200dp" />
</RelativeLayout>
<TextView
android:gravity="center_horizontal"
android:id="#+id/show4"
android:text="Show Pic"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<EditText
android:id="#+id/edit4"
android:layout_marginTop="20dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
android:gravity="start"
android:textDirection="anyRtl"
android:scrollbars="vertical"
android:textAlignment="viewStart"
android:background="#android:drawable/editbox_background_normal"
android:layout_width="match_parent"
android:layout_height="150dp" />
<TextView
android:id="#id/save"
android:layout_marginTop="10dp"
android:text="#string/save"
android:textDirection="ltr"
android:layout_marginBottom="60dp"
android:textSize="15sp"
android:background="#android:drawable/editbox_background_normal"
android:layout_gravity="center_horizontal"
android:gravity="center"
android:textColor="#android:color/holo_green_light"
android:layout_width="200dp"
android:layout_height="40dp" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
WHen I enter text in edittext and press enter from keyboard, scrollview also scroll and with multiple enter, edittext is completely invisible because of scrolling of scrollview.
is there any thing wrong in layout?

Why destructor of an extended binding is not called when extending binding is removed?

Creating a XulRunner application for Windows I found that if binding B extends binding A. And B is being removed, then only destructor of B is called, not followed by a call of A's destructor.
Is there something wrong with my code, or this is a XulRunner bug (I haven't find matching bug in bugzilla)?
Here is an example that I tested on XulRunner 23 and 35:
main.xul:
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window id="main" title="My App" width="500" height="300" sizemode="normal"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml">
<script><![CDATA[
function print(aString) {
document.getElementById("log_msg").value += aString + "\n";
}
function removeElementById(aId) {
document.getElementById(aId).remove();
};
function callF(aId) {
document.getElementById(aId).f();
}
]]></script>
<vbox flex="1">
<label onclick="removeElementById('A')">remove A</label>
<label onclick="removeElementById('B')">remove B</label>
<label onclick="callF('A')">Call A.f()</label>
<label onclick="callF('B')">Call B.f()</label>
<!--<binding-a id="A" style="-moz-binding: url('binding.xml#binding-a')"/>-->
<binding-b id="B" style="-moz-binding: url('binding.xml#binding-b')"/>
<textbox id="log_msg" label="Text" placeholder="placeholder" multiline="true" rows="6"/>
</vbox>
</window>
binding.xml:
<?xml version="1.0"?>
<bindings xmlns="http://www.mozilla.org/xbl"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<binding id="binding-a">
<content>
<xul:label anonid="label" value="Binding A"/>
</content>
<implementation>
<constructor><![CDATA[
var label = document.getAnonymousElementByAttribute(this, "anonid", "label");
label.value = label.value + " A.constructor";
window.print("A.constructor");
]]></constructor>
<destructor><![CDATA[
window.print("A.destructor");
]]></destructor>
<method name="f">
<body><![CDATA[
window.print("A.f");
]]></body>
</method>
</implementation>
</binding>
<binding id="binding-b" extends="#binding-a">
<content>
<xul:label anonid="label" value="Binding B"/>
</content>
<implementation>
<constructor><![CDATA[
window.print("B.constructor");
]]></constructor>
<destructor><![CDATA[
window.print("B.destructor");
]]></destructor>
</implementation>
</binding>
</bindings>
here is the solution for your problem:
bindings.xml:
<?xml version="1.0"?>
<bindings xmlns="http://www.mozilla.org/xbl"
xmlns:xbl="http://www.mozilla.org/xbl"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<binding id="binding-a">
<content>
<xul:label anonid="label" value="Binding A"/>
</content>
<implementation>
<constructor><![CDATA[
var label = document.getAnonymousElementByAttribute(this, "anonid", "label");
label.value = label.value + " A.constructor";
window.print("A.constructor");
]]></constructor>
<destructor><![CDATA[
this.destruct();
]]></destructor>
<method name="f">
<body><![CDATA[
window.print("A.f");
]]></body>
</method>
<method name="destruct">
<body><![CDATA[
window.print("A.destructor");
]]></body>
</method>
</implementation>
</binding>
<binding id="binding-b" extends="#binding-a">
<content>
<xul:label anonid="label" value="Binding B"/>
</content>
<implementation>
<constructor><![CDATA[
window.print("B.constructor");
]]></constructor>
<destructor><![CDATA[
this.destruct();
]]></destructor>
<method name="destruct">
<body><![CDATA[
this.__proto__.__proto__.destruct.call(this);
window.print("B.destructor");
]]></body>
</method>
</implementation>
</binding>
</bindings>
bindings.css:
#namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
binding-a { -moz-binding: url("bindings.xml#binding-a"); }
binding-b { -moz-binding: url("bindings.xml#binding-b"); }
main.xul:
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="bindings.css" type="text/css"?>
<window id="main" title="My App" width="500" height="300" sizemode="normal"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml">
<script><![CDATA[
function print(aString) {
document.getElementById("log_msg").value += aString + "\n";
}
function removeElementById(aId) {
document.getElementById(aId).remove();
};
function callF(aId) {
document.getElementById(aId).f();
}
]]></script>
<vbox flex="1">
<label onclick="removeElementById('A')">remove A</label>
<label onclick="removeElementById('B')">remove B</label>
<label onclick="callF('A')">Call A.f()</label>
<label onclick="callF('B')">Call B.f()</label>
<binding-a id="A"/>
<binding-b id="B"/>
<textbox id="log_msg" label="Text" placeholder="placeholder" multiline="true" rows="6"/>
</vbox>
</window>
I know that it is a hack in fact but it works.

How to set editView minimum Width? (Android 2.2)

I have a table containing two tableRows each holding four Views: texView, Spinner, editView and texView.
When the content of one of the spinner's childs doesn't fit, it is automatically cut of, which is fine. However I want the editView next to it keep a minimum width of 40dp. Now the width of the textViews are preserved but the editView width is not. How can I achieve that (if not by setting width and/or minwidth as I tried now, see xml file)?
Up until this child's length its fine:
Now its not so fine:
Here's the layout file:
<?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"
tools:ignore="InefficientWeight" >
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:text="Worp "
android:textAppearance="?android:attr/textAppearanceLarge" />
<TableRow
android:id="#+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView1"
android:layout_width="40dp"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:textAppearance="?android:attr/textAppearanceLarge" />
<Spinner
android:id="#+id/spinner1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:drawSelectorOnTop="true"
android:tag="SP1" />
<EditText
android:id="#+id/editText1"
android:layout_width="40dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:inputType="phone"
android:minWidth="40dp" />
<TextView
android:id="#+id/textView4"
android:layout_width="40dp"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:textAppearance="?android:attr/textAppearanceLarge" />
</TableRow>
<TableRow
android:id="#+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView2"
android:layout_width="40dp"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:textAppearance="?android:attr/textAppearanceLarge" />
<Spinner
android:id="#+id/spinner2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:drawSelectorOnTop="true"
android:tag="SP2" />
<EditText
android:id="#+id/editText2"
android:layout_width="40dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:inputType="phone"
android:minWidth="40dp" >
<requestFocus />
</EditText>
<TextView
android:id="#+id/textView5"
android:layout_width="40dp"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:textAppearance="?android:attr/textAppearanceLarge" />
</TableRow>
<TableRow
android:id="#+id/tableRow3"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
</TableRow>
<TableRow
android:id="#+id/tableRow4"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
</TableRow>
</TableLayout>
</ScrollView>
It seems that because of the wrap_content attribute the width of your table column is changing. Try to change the attributes of table row from wrap_content to match_parent or try using weightSum.

MonoDroid how to use custom attributes inside a layout axml file?

I am trying to convert the DragnDrop listview from here https://github.com/commonsguy/cwac-touchlist to C# with Mono for Android.
Part of this custom View requires the use of some custom attributes that are declared as the following inside the file Resources/values/attrs.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="TouchListView">
<attr name="normal_height" format="dimension" />
<attr name="expanded_height" format="dimension" />
<attr name="grabber" format="reference" />
<attr name="dragndrop_background" format="color" />
<attr name="remove_mode">
<enum name="none" value="-1" />
<enum name="fling" value="0" />
<enum name="slide" value="1" />
<enum name="slideRight" value="1" />
<enum name="slideLeft" value="2" />
</attr>
</declare-styleable>
</resources>
I then try to use them inside my layout file like this:
<app.monodroid.TouchListView xmlns:tlv="http://schemas.android.com/apk/res/app.monodroid"
android:id="#+id/lstExercises"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="#+id/lExerciseActions"
android:drawSelectorOnTop="false"
tlv:normal_height="64dip"
tlv:grabber="#+id/icon"
tlv:remove_mode="slideRight"
/>
But when I try to build my project I get the following error message:
/Library/Frameworks/Mono.framework/External/xbuild/Novell/Novell.MonoDroid.Common.targets: Error: Tool exited with code: 1. Output: /Users/path_to_project/App.MonoDroid/obj/Debug/res/layout/add_session.axml:1: error: No resource identifier found for attribute 'normal_height' in package 'com.app.monodroid'
/Users/path_to_project/App.MonoDroid/obj/Debug/res/layout/add_session.axml:1: error: No resource identifier found for attribute 'grabber' in package 'com.app.monodroid'
/Users/path_to_project/App.MonoDroid/obj/Debug/res/layout/add_session.axml:1: error: No resource identifier found for attribute 'remove_mode' in package 'com.app.monodroid'
(App.MonoDroid)
The name of my project is App.MonoDroid.
How can I use these attributes inside my layout file?
These errors should go away if you declare a package name for your app. In the project properties, go to the Android Manifest tab, and you'll see a text field for Package Name:
... and then make sure you use this package name for your assembly and namespace:
and use it in your xml file:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:custom="http://schemas.android.com/apk/res/**app.monodroid**"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<**app.monodroid**.FICalendarView
android:id="#+id/FICalendar"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
custom:dayStyle="1">
</**app.monodroid**.FICalendarView>
<Button
android:id="#+id/MyButton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/Hello"/>
</LinearLayout>
where FICaldendarView is a custom view defined as:
namespace app.monodroid
{
public class FICalendarView : View
{
//private FICalenderView() {}
public FICalendarView(Context context)
: base(context)
{
}
public FICalendarView(Context context, Android.Util.IAttributeSet attribute)
: base(context, attribute)
{
Android.Content.Res.TypedArray a = context.Theme.ObtainStyledAttributes(attribute, Resource.Styleable.FICalendarView, 0, 0);
//Android.Util.TypedValue typedValue = null;
int dayStyle = a.GetInteger(Resource.Styleable.FICalendarView_dayStyle,0);
}
public FICalendarView(Context context, Android.Util.IAttributeSet attribute, int x)
: base(context, attribute,x)
{
}
}
}

Resources