I have an XML layout which I'm attempting to add a series of buttons to (A-Z). Thus far I have been able to do so - however they appear lumped together on the left hand side. I'd like for them to be evenly spaced - and I thought that using something such as:
android:layout_marginLeft="fill_parent"
android:layout_marginRight="fill_parent"
Would space them evenly across the screen - however I'm left with multiple errors stating:
"Error: String types not allowed (at 'layout_marginLeft' with value 'fill_parent')."
ScreenShot: http://ift.tt/1IykDdR
Current Source:
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<LinearLayout
android:id="@+id/drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="end"
android:background="@android:color/white"
android:orientation="vertical" >
<ListView
android:id="@+id/drawer_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black"
android:choiceMode="singleChoice"
android:divider="@android:color/darker_gray"
android:dividerHeight="0.1dp"
android:textColor="@android:color/white" />
</LinearLayout>
<ListView
android:id="@+id/left_drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="right"
android:background="#111"
android:choiceMode="singleChoice"
android:divider="@android:color/transparent"
android:dividerHeight="0dp" />
<LinearLayout
android:id="@+id/mainContent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="00dp"
android:layout_marginTop="0dp"
android:orientation="vertical" >
<!-- 1st Child Layout (Nested In Parent Layout) with Horizontal Orientation -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:layout_marginTop="15dp"
android:background="@drawable/searchbar"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="20dip" >
<EditText
android:id="@+id/editText1"
android:layout_width="380dp"
android:layout_height="30dp"
android:layout_alignParentTop="true"
android:background="@drawable/searchbartxtcontainer"
android:ems="10"
android:hint=" Search Movies" >
<requestFocus />
</EditText>
<Spinner
android:id="@+id/spinner1"
android:layout_marginLeft="50dp"
android:entries="@array/home_spinner1_array"
android:prompt="@string/select_location"
android:layout_width="100dp"
android:layout_height="30dp"
android:layout_toRightOf="@+id/editText1"
android:background="@drawable/searchbartxtcontainer"
android:textColor="@android:color/white"
android:hint="Rating" />
<Spinner
android:id="@+id/spinner2"
android:entries="@array/home_spinner2_array"
android:text="Genre"
android:layout_width="140dp"
android:layout_height="30dp"
android:layout_alignTop="@+id/spinner1"
android:layout_marginLeft="50dp"
android:textColor="@android:color/white"
android:hint="Genre"
android:layout_toRightOf="@+id/spinner1"
android:background="@drawable/searchbartxtcontainer" />
<Button
android:id="@+id/button1"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="33dp"
android:textColor="@android:color/white"
android:layout_marginLeft="50dp"
android:background="#4D4D4D"
android:layout_toRightOf="@+id/spinner2"
android:text="Reset" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/button1"
android:layout_marginLeft="50dp"
android:text="Sort by:"
android:textColor="@android:color/white" />
<Spinner
android:id="@+id/spinner3"
android:layout_width="120dp"
android:layout_height="30dp"
android:layout_alignTop="@+id/textView1"
android:layout_marginLeft="20dp"
android:layout_toRightOf="@+id/textView1"
android:background="@drawable/searchbartxtcontainer"
android:hint="Release Date"
android:textColor="@android:color/white" />
</LinearLayout>
<!-- 2nd Child Layout (Nested In Parent Layout) with Horizontal Orientation -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#000000"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="20dip" >
<Button
android:id="@+id/buttona"
style="?android:attr/buttonStyleSmall"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginLeft="fill_parent"
android:layout_marginRight="fill_parent"
android:layout_toRightOf="@+id/spinner2"
android:text="A" />
<Button
android:id="@+id/buttonb"
style="?android:attr/buttonStyleSmall"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginLeft="fill_parent"
android:layout_marginRight="fill_parent"
android:layout_toRightOf="@+id/spinner2"
android:text="B" />
<Button
android:id="@+id/buttonc"
style="?android:attr/buttonStyleSmall"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginLeft="fill_parent"
android:layout_marginRight="fill_parent"
android:layout_toRightOf="@+id/spinner2"
android:text="C" />
<Button
android:id="@+id/buttond"
style="?android:attr/buttonStyleSmall"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginLeft="fill_parent"
android:layout_marginRight="fill_parent"
android:layout_toRightOf="@+id/spinner2"
android:text="D" />
<Button
android:id="@+id/buttone"
style="?android:attr/buttonStyleSmall"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginLeft="fill_parent"
android:layout_marginRight="fill_parent"
android:layout_toRightOf="@+id/spinner2"
android:text="E" />
<Button
android:id="@+id/buttonf"
style="?android:attr/buttonStyleSmall"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginLeft="fill_parent"
android:layout_marginRight="fill_parent"
android:layout_toRightOf="@+id/spinner2"
android:text="F" />
<Button
android:id="@+id/buttong"
style="?android:attr/buttonStyleSmall"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginLeft="fill_parent"
android:layout_marginRight="fill_parent"
android:layout_toRightOf="@+id/spinner2"
android:text="G" />
<Button
android:id="@+id/buttonh"
style="?android:attr/buttonStyleSmall"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginLeft="fill_parent"
android:layout_marginRight="fill_parent"
android:layout_toRightOf="@+id/spinner2"
android:text="H" />
<Button
android:id="@+id/buttoni"
style="?android:attr/buttonStyleSmall"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginLeft="fill_parent"
android:layout_marginRight="fill_parent"
android:layout_toRightOf="@+id/spinner2"
android:text="I" />
<Button
android:id="@+id/buttonj"
style="?android:attr/buttonStyleSmall"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginLeft="fill_parent"
android:layout_marginRight="fill_parent"
android:layout_toRightOf="@+id/spinner2"
android:text="J" />
<Button
android:id="@+id/buttonk"
style="?android:attr/buttonStyleSmall"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginLeft="fill_parent"
android:layout_marginRight="fill_parent"
android:layout_toRightOf="@+id/spinner2"
android:text="K" />
<Button
android:id="@+id/buttonl"
style="?android:attr/buttonStyleSmall"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginLeft="fill_parent"
android:layout_marginRight="fill_parent"
android:layout_toRightOf="@+id/spinner2"
android:text="L" />
<Button
android:id="@+id/buttonm"
style="?android:attr/buttonStyleSmall"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginLeft="fill_parent"
android:layout_marginRight="fill_parent"
android:layout_toRightOf="@+id/spinner2"
android:text="M" />
<Button
android:id="@+id/buttonn"
style="?android:attr/buttonStyleSmall"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginLeft="fill_parent"
android:layout_marginRight="fill_parent"
android:layout_toRightOf="@+id/spinner2"
android:text="N" />
<Button
android:id="@+id/buttono"
style="?android:attr/buttonStyleSmall"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginLeft="fill_parent"
android:layout_marginRight="fill_parent"
android:layout_toRightOf="@+id/spinner2"
android:text="O" />
<Button
android:id="@+id/buttonp"
style="?android:attr/buttonStyleSmall"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginLeft="fill_parent"
android:layout_marginRight="fill_parent"
android:layout_toRightOf="@+id/spinner2"
android:text="P" />
<Button
android:id="@+id/buttonq"
style="?android:attr/buttonStyleSmall"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginLeft="fill_parent"
android:layout_marginRight="fill_parent"
android:layout_toRightOf="@+id/spinner2"
android:text="Q" />
<Button
android:id="@+id/buttonr"
style="?android:attr/buttonStyleSmall"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginLeft="fill_parent"
android:layout_marginRight="fill_parent"
android:layout_toRightOf="@+id/spinner2"
android:text="R" />
<Button
android:id="@+id/buttons"
style="?android:attr/buttonStyleSmall"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginLeft="fill_parent"
android:layout_marginRight="fill_parent"
android:layout_toRightOf="@+id/spinner2"
android:text="S" />
<Button
android:id="@+id/buttont"
style="?android:attr/buttonStyleSmall"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginLeft="fill_parent"
android:layout_marginRight="fill_parent"
android:layout_toRightOf="@+id/spinner2"
android:text="T" />
<Button
android:id="@+id/buttonu"
style="?android:attr/buttonStyleSmall"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginLeft="fill_parent"
android:layout_marginRight="fill_parent"
android:layout_toRightOf="@+id/spinner2"
android:text="U" />
<Button
android:id="@+id/buttonv"
style="?android:attr/buttonStyleSmall"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginLeft="fill_parent"
android:layout_marginRight="fill_parent"
android:layout_toRightOf="@+id/spinner2"
android:text="V" />
<Button
android:id="@+id/buttonw"
style="?android:attr/buttonStyleSmall"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginLeft="fill_parent"
android:layout_marginRight="fill_parent"
android:layout_toRightOf="@+id/spinner2"
android:text="W" />
<Button
android:id="@+id/buttonx"
style="?android:attr/buttonStyleSmall"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginLeft="fill_parent"
android:layout_marginRight="fill_parent"
android:layout_toRightOf="@+id/spinner2"
android:text="X" />
<Button
android:id="@+id/buttony"
style="?android:attr/buttonStyleSmall"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginLeft="fill_parent"
android:layout_marginRight="fill_parent"
android:layout_toRightOf="@+id/spinner2"
android:text="Y" />
<Button
android:id="@+id/buttonz"
style="?android:attr/buttonStyleSmall"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginLeft="fill_parent"
android:layout_marginRight="fill_parent"
android:layout_toRightOf="@+id/spinner2"
android:text="Z" />
</LinearLayout>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@+id/imageView1" >
<!-- 3rd Child Layout (Nested In Parent Layout) with Horizontal Orientation -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="0dp"
android:background="#000000"
android:orientation="vertical" >
<!-- Container view to scroll horizontally which gives the carousel effect -->
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none" >
<!-- Carousel items container - lays out items horizontally -->
<LinearLayout
android:id="@+id/carousel1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" />
</HorizontalScrollView>
<!-- Container view to scroll horizontally which gives the carousel effect -->
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none" >
<!-- Carousel items container - lays out items horizontally -->
<LinearLayout
android:id="@+id/carousel2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="horizontal" />
</HorizontalScrollView>
<!-- Container view to scroll horizontally which gives the carousel effect -->
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none" >
<!-- Carousel items container - lays out items horizontally -->
<LinearLayout
android:id="@+id/carousel3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="horizontal" />
</HorizontalScrollView>
<!-- Container view to scroll horizontally which gives the carousel effect -->
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none" >
<!-- Carousel items container - lays out items horizontally -->
<LinearLayout
android:id="@+id/carousel4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="horizontal" />
</HorizontalScrollView>
<!-- Container view to scroll horizontally which gives the carousel effect -->
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none" >
<!-- Carousel items container - lays out items horizontally -->
<LinearLayout
android:id="@+id/carousel5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="horizontal" />
</HorizontalScrollView>
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none" >
<!-- Carousel items container - lays out items horizontally -->
<LinearLayout
android:id="@+id/carousel6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="horizontal" />
</HorizontalScrollView>
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none" >
<!-- Carousel items container - lays out items horizontally -->
<LinearLayout
android:id="@+id/carousel7"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="horizontal" />
</HorizontalScrollView>
</LinearLayout>
</ScrollView>
<!-- 4th Child Layout (Nested In Parent Layout) with Horizontal Orientation -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/clear" />
</LinearLayout>
</LinearLayout>
<ProgressBar
android:id="@+id/progress_bar"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:indeterminateDrawable="@drawable/ic_launcher"
android:visibility="gone" >
</ProgressBar>
<!-- List of Actions (pages) -->
<ListView
android:id="@+id/navList"
android:layout_width="280dp"
android:layout_height="match_parent"
android:layout_below="@+id/profileBox"
android:layout_gravity="end"
android:background="#ffffffff"
android:choiceMode="singleChoice" />
<ImageView
android:id="@+id/drawer_item_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
Aucun commentaire:
Enregistrer un commentaire