I have this XML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/upperBar"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#android:color/darker_gray"
>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/txtForum"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textSize="25dp"
android:textColor="#255094"
android:layout_centerVertical="true"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_alignParentLeft="true"
android:maxLines="2"
android:scrollbars="vertical"
>
</TextView>
<ImageButton
android:id="#+id/btnBrowser"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_alignParentRight="true"
android:src="#drawable/icon_browser"
android:contentDescription="Open Browser"
>
</ImageButton>
<Button
android:id="#+id/btnNewThread"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="NewThread"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_toLeftOf="#+id/btnBrowser">
</Button>
</RelativeLayout>
<ListView
android:id="#+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:cacheColorHint="#00000000"
android:padding="10dp"
android:layout_below="#+id/upperBar">
</ListView>
</LinearLayout>
And looks like this:
The problem is that, when the TextView is too long, it overlaps the buttons. I'd like to have those elements independently that the text is long. What should I add to my code?
Thank you.
Add following code android:layout_toLeftOf="#+id/btnBrowser" for the text view.
Hi I'm newly entered in this project. How to reduce listview text view distance please...
xml code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/thumb"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="3dip"
android:layout_alignParentLeft="true"
android:layout_marginRight="5dip">
<ImageView
android:id="#+id/img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<TextView
android:id="#+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/thumb"
android:layout_toRightOf="#+id/thumb"
android:layout_centerVertical="true"
android:layout_marginTop="1000dip"
android:textColor="#ffffff"/>
<TextView
android:id="#+id/detail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/thumb"
android:layout_alignParentBottom="true"
android:textColor="#ffffff" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/imgArrow"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"/>
</RelativeLayout>
You have given android:layout_alignParentBottom="true" to the below text.so it will set itself to the bottom of the layout.Either remove this and give marginTop to the this text or give marginTop to the above text.Here is only problem,look at it.
Use this XML as the list_item of your listview and make changes wherever needed
<?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:orientation="horizontal" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/ic_launcher"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="5dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="aaaaaaaaaaaaaaaaa"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="bbbbbbbbbbbbbbb"/>
</LinearLayout>
</LinearLayout>
i dont know whether this is the only reqirement of yours though i have tried to shorten the distance between them.Try it n Hope this will help you.
I have an EditText (that the user can type numbers in),
so when the user clicks on the EditText text box a keyboard with numbers is opened.
as you can see the keyboard hides a small part of the text box.
But when I press a key, for example, 0, it looks ok.
Is there anything I can do (besides putting the EditText higher) so it will looks like it does in the second picture?
Edit: the .xml code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:weightSum="1">
<RelativeLayout android:id="#+id/relativeLayout1" android:layout_width="fill_parent" android:layout_height="wrap_content">
<LinearLayout android:layout_width="wrap_content" android:orientation="vertical" android:layout_height="wrap_content" android:id="#+id/linearLayout1" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_alignParentRight="true">
<android.widget.CheckedTextView android:id="#+id/checkedTextView1" android:layout_height="wrap_content" android:layout_width="fill_parent" android:textSize="17sp" android:text="#string/toString"></android.widget.CheckedTextView>
<AutoCompleteTextView android:layout_height="wrap_content" android:id="#+id/autoCompleteTextView1" android:layout_width="fill_parent" android:text="#string/emptyString" android:textSize="17sp" android:gravity="top|left" android:minHeight="62dp">
<requestFocus></requestFocus>
</AutoCompleteTextView>
<LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="#+id/linearLayout2">
<Button android:layout_height="wrap_content" android:layout_width="fill_parent" android:layout_weight="0.33333333333" android:text="#string/contactsString" android:textSize="17sp" android:id="#+id/contactsButton"></Button>
<Button android:layout_weight="0.33333333333" android:layout_height="wrap_content" android:text="#string/groupsString" android:layout_width="fill_parent" android:id="#+id/groupsButton" android:textSize="17sp"></Button>
<Button android:layout_weight="0.33333333333" android:layout_height="wrap_content" android:text="#string/favouritesString" android:layout_width="fill_parent" android:id="#+id/button3" android:textSize="17sp"></Button>
</LinearLayout>
<TextView android:id="#+id/textView1" android:text="#string/messageString" android:layout_height="wrap_content" android:textSize="17sp" android:layout_width="fill_parent"></TextView>
<EditText android:layout_height="wrap_content" android:id="#+id/editText1" android:layout_width="fill_parent" android:gravity="top|left" android:minHeight="105dp"></EditText>
<TextView android:id="#+id/textView2" android:text="#string/repetition" android:layout_height="wrap_content" android:layout_width="fill_parent" android:textSize="17sp"></TextView>
<Spinner android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="#+id/spinner"></Spinner>
<LinearLayout android:layout_height="wrap_content" android:id="#+id/linearLayout3" android:layout_width="fill_parent">
<ImageView android:src="#drawable/button_time" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="#+id/imageView1" android:layout_weight="0.1"></ImageView>
<EditText android:layout_height="wrap_content" android:id="#+id/timeET" android:inputType="number" android:layout_width="wrap_content" android:layout_weight="0.4"></EditText>
<ImageView android:src="#drawable/button_date" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="#+id/imageView2" android:layout_weight="0.1"></ImageView>
<EditText android:layout_height="wrap_content" android:id="#+id/dateET" android:inputType="number" android:layout_width="wrap_content" android:layout_weight="0.4" android:layout_marginRight="3dp"></EditText>
</LinearLayout>
<RelativeLayout android:id="#+id/relativeLayout2" android:layout_width="fill_parent" android:layout_height="fill_parent">
<LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="#+id/linearLayout4" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" android:layout_alignParentLeft="true">
<Button android:layout_weight="0.5" android:layout_height="wrap_content" android:text="#string/button_ok" android:layout_width="fill_parent" android:id="#+id/button4" android:textSize="17sp"></Button>
<Button android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="#+id/button5" android:layout_weight="0.5" android:text="#string/button_cancel" android:textSize="17sp"></Button>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
I have tried your XML and yes you are right the problem occur.
To solve the problem I have written this line in my MainActivity.java hope this help to you,And put the layout XML in ScrollView.
Activity
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.temp);
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
final EditText time = (EditText)findViewById(R.id.timeET);
time.setOnTouchListener(new OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
time.requestLayout();
MyActivity.this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_UNSPECIFIED);
return false;
}
});
final EditText date = (EditText)findViewById(R.id.dateET);
date.setOnTouchListener(new OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
time.requestLayout();
MyActivity.this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_UNSPECIFIED);
return false;
}
});
}
And The XML is Like,
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ScrollView android:id="#+id/scrollView1"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:weightSum="1">
---
---
---
</ScrollView>
</LinearLayout>
Change to ScrollView in this way:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:weightSum="1" >
<RelativeLayout
android:id="#+id/relativeLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="wrap_content"
android:orientation="vertical"
android:layout_height="wrap_content"
android:id="#+id/linearLayout1"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true" >
<android.widget.CheckedTextView
android:id="#+id/checkedTextView1"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:textSize="17sp"
android:text="#string/toString" />
<AutoCompleteTextView
android:layout_height="wrap_content"
android:id="#+id/autoCompleteTextView1"
android:layout_width="fill_parent"
android:text="#string/emptyString"
android:textSize="17sp"
android:gravity="top|left"
android:minHeight="62dp" >
<requestFocus></requestFocus>
</AutoCompleteTextView>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/linearLayout2" >
<Button
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_weight="0.33333333333"
android:text="#string/contactsString"
android:textSize="17sp"
android:id="#+id/contactsButton" />
<Button
android:layout_weight="0.33333333333"
android:layout_height="wrap_content"
android:text="#string/groupsString"
android:layout_width="fill_parent"
android:id="#+id/groupsButton"
android:textSize="17sp" />
<Button
android:layout_weight="0.33333333333"
android:layout_height="wrap_content"
android:text="#string/favouritesString"
android:layout_width="fill_parent"
android:id="#+id/button3"
android:textSize="17sp" />
</LinearLayout>
<TextView
android:id="#+id/textView1"
android:text="#string/messageString"
android:layout_height="wrap_content"
android:textSize="17sp"
android:layout_width="fill_parent" />
<EditText
android:layout_height="wrap_content"
android:id="#+id/editText1"
android:layout_width="fill_parent"
android:gravity="top|left"
android:minHeight="105dp" />
<TextView
android:id="#+id/textView2"
android:text="#string/repetition"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:textSize="17sp" />
<Spinner
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/spinner" />
<LinearLayout
android:layout_height="wrap_content"
android:id="#+id/linearLayout3"
android:layout_width="fill_parent" >
<ImageView
android:src="#drawable/button_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/imageView1"
android:layout_weight="0.1" />
<EditText
android:layout_height="wrap_content"
android:id="#+id/timeET"
android:inputType="number"
android:layout_width="wrap_content"
android:layout_weight="0.4" />
<ImageView
android:src="#drawable/button_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/imageView2"
android:layout_weight="0.1" />
<EditText
android:layout_height="wrap_content"
android:id="#+id/dateET"
android:inputType="number"
android:layout_width="wrap_content"
android:layout_weight="0.4"
android:layout_marginRight="3dp" />
</LinearLayout>
<RelativeLayout
android:id="#+id/relativeLayout2"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/linearLayout4"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentLeft="true" >
<Button
android:layout_weight="0.5"
android:layout_height="wrap_content"
android:text="#string/button_ok"
android:layout_width="fill_parent"
android:id="#+id/button4"
android:textSize="17sp" />
<Button
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:id="#+id/button5"
android:layout_weight="0.5"
android:text="#string/button_cancel"
android:textSize="17sp" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</ScrollView>
put the entire view inside a ScrollView and set the android:windowSoftInputMode = adjustPan it will do the trick.
you just need to add this piece of code,
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
Your linear layout here....
</ScrollView>
I have tested it on my HTC Desire and its working fine for me hope it will work for you too.
Set android:windowSoftInputMode on the Activity to "adjustPan":
The activity's main window is not resized to make room for the soft keyboard. Rather, the contents of the window are automatically panned so that the current focus is never obscured by the keyboard and users can always see what they are typing.
Beware of one potential bug when using this technique with a fullscreen activity.
You can give some hints to the system on how to handle this via android:windowSoftInputMode element on the declared activity in the AndroidManifest. Try the "adjustResize" value.
android:windowSoftInputMode
This is a much simpler fix than the accepted answer. The key is the <item name="android:windowSoftInputMode">adjustUnspecified</item> line. Add it to your styles.xml:
<style name="AppTheme" parent="#android:Theme.Holo.Light.DarkActionBar">
<item name="android:alertDialogTheme">#style/iconPopUpDialogTheme</item>
</style>
<style name="DialogAppTheme" parent="AppTheme">
<item name="android:dialogTheme">#style/iconPopUpDialogTheme</item>
</style>
<style name="PopUpDialogTheme">
<item name="android:windowSoftInputMode">adjustUnspecified</item>
</style>
try changing linear layout to scroll view...so that if keyboard comes above editt text user can scroll and type...
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:weightSum="1">
<RelativeLayout android:id="#+id/relativeLayout1"
android:layout_width="fill_parent" android:layout_height="wrap_content">
<LinearLayout android:layout_width="wrap_content"
android:orientation="vertical" android:layout_height="wrap_content"
android:id="#+id/linearLayout1" android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true" android:layout_alignParentTop="true"
android:layout_alignParentRight="true">
<android.widget.CheckedTextView
android:id="#+id/checkedTextView1" android:layout_height="wrap_content"
android:layout_width="fill_parent" android:textSize="17sp"></android.widget.CheckedTextView>
<AutoCompleteTextView android:layout_height="wrap_content"
android:id="#+id/autoCompleteTextView1" android:layout_width="fill_parent"
android:textSize="17sp" android:gravity="top|left"
android:minHeight="62dp">
<requestFocus></requestFocus>
</AutoCompleteTextView>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content" android:id="#+id/linearLayout2">
<Button android:layout_height="wrap_content"
android:layout_width="fill_parent" android:layout_weight="0.33333333333"
android:textSize="17sp" android:id="#+id/contactsButton"></Button>
<Button android:layout_weight="0.33333333333"
android:layout_height="wrap_content" android:layout_width="fill_parent"
android:id="#+id/groupsButton" android:textSize="17sp"></Button>
<Button android:layout_weight="0.33333333333"
android:layout_height="wrap_content" android:layout_width="fill_parent"
android:id="#+id/button3" android:textSize="17sp"></Button>
</LinearLayout>
<TextView android:id="#+id/textView1" android:layout_height="wrap_content"
android:textSize="17sp" android:layout_width="fill_parent"></TextView>
<EditText android:layout_height="wrap_content" android:id="#+id/editText1"
android:layout_width="fill_parent" android:gravity="top|left"
android:minHeight="105dp"></EditText>
<TextView android:id="#+id/textView2" android:layout_height="wrap_content"
android:layout_width="fill_parent" android:textSize="17sp"></TextView>
<Spinner android:layout_width="fill_parent"
android:layout_height="wrap_content" android:id="#+id/spinner"></Spinner>
<LinearLayout android:layout_height="wrap_content"
android:id="#+id/linearLayout3" android:layout_width="fill_parent">
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="#+id/imageView1"
android:layout_weight="0.1"></ImageView>
<EditText android:layout_height="wrap_content" android:id="#+id/timeET"
android:inputType="number" android:layout_width="wrap_content"
android:layout_weight="0.4"></EditText>
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="#+id/imageView2"
android:layout_weight="0.1"></ImageView>
<EditText android:layout_height="wrap_content" android:id="#+id/dateET"
android:inputType="number" android:layout_width="wrap_content"
android:layout_weight="0.4" android:layout_marginRight="3dp"></EditText>
</LinearLayout>
<RelativeLayout android:id="#+id/relativeLayout2"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<LinearLayout android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="#+id/linearLayout4"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentLeft="true">
<Button android:layout_weight="0.5" android:layout_height="wrap_content"
android:layout_width="fill_parent" android:id="#+id/button4"
android:textSize="17sp"></Button>
<Button android:layout_height="wrap_content"
android:layout_width="fill_parent" android:id="#+id/button5"
android:layout_weight="0.5" android:textSize="17sp"></Button>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
please make necesscery changes...i have removed strings and drawable src for my convience..u need to change first
linear layout to scrollview..try without this
android:windowSoftInputMode = adjustPan
Add this simple line in your Manifest.xml file:
android:windowSoftInputMode="adjustResize|stateHidden"
what ever I try it always ends up so the second checkbox in a row doesn't show, and I don't know how to put admob wedget on the bottom of the screen
This is what I'm aiming for, thanks ahead of time:
Try this...the trick is to use relative layout for the outermost layout and nest some linear layouts to get the check boxes to align
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout android:id="#+id/top_row" android:layout_alignParentTop="true" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_above="#+id/bottom_row">
<EditText android:id="#+id/edit_text1" android:layout_height="wrap_content" android:layout_width="fill_parent" android:text="edit text"></EditText>
<LinearLayout android:id="#+id/check_box_holder" android:orientation="horizontal" android:layout_height="wrap_content" android:layout_width="fill_parent">
<LinearLayout android:id="#+id/check_box_left_col" android:orientation="vertical" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_weight="1">
<CheckBox android:id="#+id/CheckBox01" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_alignParentLeft="true" android:text="CheckBox01"></CheckBox>
<CheckBox android:id="#+id/CheckBox02" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_alignParentLeft="true" android:text="CheckBox02"></CheckBox>
</LinearLayout>
<LinearLayout android:id="#+id/check_box_right_col" android:orientation="vertical" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_weight="1">
<CheckBox android:id="#+id/CheckBox03" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_alignParentLeft="true" android:text="CheckBox03"></CheckBox>
<CheckBox android:id="#+id/CheckBox04" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_alignParentLeft="true" android:text="CheckBox04"></CheckBox>
</LinearLayout>
</LinearLayout>
<Button android:id="#+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:text="button1"> </Button>
<EditText android:id="#+id/edit_text2" android:layout_height="wrap_content" android:layout_width="fill_parent" android:text="edit text2"></EditText>
<Button android:id="#+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:text="button2"> </Button>
</LinearLayout>
<LinearLayout android:id="#+id/bottom_row" android:layout_alignParentBottom="true" android:orientation="horizontal" android:layout_width="fill_parent" android:gravity="center" android:layout_height="wrap_content" android:background="#88ffffff">
<com.admob.android.ads.AdView
android:id="#+id/ad_block"
android:layout_margin="1px" android:layout_width="350dip" android:layout_gravity="center" android:layout_height="58dip"/>
</LinearLayout>
</RelativeLayout>
I created a custom layout where I have a couple of LinearLayout in a ScrollView. Problem is when I set my layout in setContentView() to my custom layout (when the application starts), the emulator gives an error and force closes! I don't know why. I have tried with another custom layout or set it to main and it seems to work fine.
Any ideas what could be wrong?
Yes, I meant to say the app is crashing. Here is the xml code for the custom layout: (too many spinners!)
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbars="vertical">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dp">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/Name"
android:id="#+id/name"
android:textSize="18sp"
android:gravity="center">
</TextView>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="10dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/Picker"
android:text="#string/drinkText"
android:textColor="#303030">
</TextView>
<View
android:layout_height="5dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/TimePicker"
android:text="#string/TimeText"
android:textColor="#303030">
</TextView>
<View
android:layout_height="20dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#id/EndPicker"
android:text="#string/EndText"
android:textColor="#303030">
</TextView>
<View
android:layout_height="5dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#id/sortPicker"
android:text="#string/sortText"
android:textColor="#303030">
</TextView>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Categories:"
android:id="#+id/CategorySelect"/>
<Spinner
android:id="#+id/categorySpinner"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:drawSelectorOnTop="true"
android:prompt="#string/categoriesPrompt"
android:visibility="visible"/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Priority:"
android:id="#+id/prioritySelect"/>
<Spinner
android:id="#+id/prioritySpinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawSelectorOnTop="true"
android:prompt="#string/priorityPrompt"
android:visibility="visible" android:layout_weight="0.0"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="State:"
android:id="#+id/stateSelect"/>
<Spinner
android:id="#+id/statusSpinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawSelectorOnTop="true"
android:prompt="#string/statusPrompt"
android:visibility="visible"/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Reminder:"
android:id="#+id/Reminder"/>
<Spinner
android:id="#+id/remindSpinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawSelectorOnTop="true"
android:prompt="#string/remindPrompt"
android:visibility="visible"/>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dp"
android:background="#FF303030">
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="suggestions:"
android:typeface="sans">
</TextView>
</LinearLayout>
</LinearLayout>
</ScrollView>
The problem is that you're specifying a view without including a required attribute (layout_width).
<View android:layout_height="5dp"/>
It's up to you to define the expected behavior for width, but here's one example that will fix your problem:
<View android:layout_height="5dp" layout_width="fill_parent" />
The Android developer documentation indicates these fields are required (source: http://developer.android.com/guide/topics/resources/layout-resource.html).