Admob banner added programatically needs to be at the bottom - java

I have an advmob banner which was added programatically as bellow :
public class MenuActivity extends Activity {
AdView adView ;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activitymain);
adView = new AdView(this, AdSize.BANNER, "a15013b6f790555");
AdRequest adRequest = new AdRequest();
adRequest.addTestDevice(AdRequest.TEST_EMULATOR);
RelativeLayout.LayoutParams relativeParams = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.WRAP_CONTENT,
RelativeLayout.LayoutParams.WRAP_CONTENT);
relativeParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
adView.loadAd(adRequest);
this.addContentView(adView, relativeParams);
When I run it the banner comes at the top of the screen , I want it to be at the bottom
Here is the xml layout also:
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="#drawable/mainbackgroundipad">
<TableRow android:id="#+id/tableRow1">
<ImageButton
android:id="#+id/menu1"
android:layout_width="75dip"
android:layout_height="74dip"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginTop="57dp"
android:background="#android:color/transparent"
android:scaleType="fitXY"
android:src="#drawable/menu1" />
<ImageButton
android:id="#+id/menu2"
android:layout_width="75dp"
android:layout_height="59dp"
android:layout_marginLeft="5dp"
android:layout_marginTop="70dp"
android:background="#android:color/transparent"
android:scaleType="fitXY"
android:src="#drawable/menu2" />
<ImageButton
android:id="#+id/menu3"
android:layout_width="75dip"
android:layout_height="63dip"
android:layout_marginLeft="1dp"
android:layout_marginTop="70dp"
android:background="#android:color/transparent"
android:scaleType="fitXY"
android:src="#drawable/menu3" />
<ImageButton
android:id="#+id/menu4"
android:layout_width="60dp"
android:layout_height="83dp"
android:layout_marginRight="100dp"
android:layout_marginTop="50dp"
android:background="#android:color/transparent"
android:scaleType="fitCenter"
android:src="#drawable/menu4" />
</TableRow>
<TableRow android:id="#+id/tableRow2">
<ImageButton
android:id="#+id/menu5"
android:layout_width="50dp"
android:layout_height="75dp"
android:layout_marginLeft="12dp"
android:layout_marginTop="60dp"
android:background="#android:color/transparent"
android:scaleType="fitXY"
android:src="#drawable/menu5" />
<ImageButton
android:id="#+id/menu6"
android:layout_width="60dp"
android:layout_height="79dp"
android:layout_marginTop="60dp"
android:background="#android:color/transparent"
android:scaleType="fitXY"
android:src="#drawable/menu6" />
<ImageButton
android:id="#+id/menu7"
android:layout_width="60dip"
android:layout_height="86dip"
android:layout_marginLeft="5dp"
android:layout_marginTop="60dp"
android:background="#android:color/transparent"
android:scaleType="fitStart"
android:src="#drawable/menu7" />
<ImageButton
android:id="#+id/menu8"
android:layout_width="75dip"
android:layout_height="50dip"
android:layout_centerVertical="true"
android:layout_marginRight="110dp"
android:layout_marginTop="80dp"
android:background="#android:color/transparent"
android:scaleType="fitXY"
android:src="#drawable/menu8" />
</TableRow>
<TableRow android:id="#+id/tableRow3">
<ImageButton
android:id="#+id/menu9"
android:layout_width="60px"
android:layout_height="80px"
android:layout_marginLeft="2dp"
android:layout_marginTop="40dp"
android:background="#android:color/transparent"
android:scaleType="fitXY"
android:src="#drawable/menu9" />
<ImageButton
android:id="#+id/menu10"
android:layout_width="75dip"
android:layout_height="56dip"
android:layout_alignParentLeft="true"
android:layout_marginLeft="2dp"
android:layout_marginTop="70dp"
android:background="#android:color/transparent"
android:scaleType="fitXY"
android:src="#drawable/menu10" />
<ImageButton
android:id="#+id/menu11"
android:layout_width="75dip"
android:layout_height="65dip"
android:layout_alignParentLeft="true"
android:layout_marginLeft="2dp"
android:layout_marginTop="70dp"
android:background="#android:color/transparent"
android:scaleType="fitXY"
android:src="#drawable/menu11" />
<ImageButton
android:id="#+id/menu12"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_marginRight="100dp"
android:layout_marginTop="70dp"
android:background="#android:color/transparent"
android:scaleType="fitXY"
android:src="#drawable/menu12" />
</TableRow>
</TableLayout>

Change your XML file like this:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/rootview"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="#drawable/mainbackgroundipad"
android:orientation="vertical" >
<TableRow android:id="#+id/tableRow1" >
<ImageButton
android:id="#+id/menu1"
android:layout_width="75dip"
android:layout_height="74dip"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginTop="57dp"
android:background="#android:color/transparent"
android:scaleType="fitXY"
android:src="#drawable/menu1" />
<ImageButton
android:id="#+id/menu2"
android:layout_width="75dp"
android:layout_height="59dp"
android:layout_marginLeft="5dp"
android:layout_marginTop="70dp"
android:background="#android:color/transparent"
android:scaleType="fitXY"
android:src="#drawable/menu2" />
<ImageButton
android:id="#+id/menu3"
android:layout_width="75dip"
android:layout_height="63dip"
android:layout_marginLeft="1dp"
android:layout_marginTop="70dp"
android:background="#android:color/transparent"
android:scaleType="fitXY"
android:src="#drawable/menu3" />
<ImageButton
android:id="#+id/menu4"
android:layout_width="60dp"
android:layout_height="83dp"
android:layout_marginRight="100dp"
android:layout_marginTop="50dp"
android:background="#android:color/transparent"
android:scaleType="fitCenter"
android:src="#drawable/menu4" />
</TableRow>
<TableRow android:id="#+id/tableRow2" >
<ImageButton
android:id="#+id/menu5"
android:layout_width="50dp"
android:layout_height="75dp"
android:layout_marginLeft="12dp"
android:layout_marginTop="60dp"
android:background="#android:color/transparent"
android:scaleType="fitXY"
android:src="#drawable/menu5" />
<ImageButton
android:id="#+id/menu6"
android:layout_width="60dp"
android:layout_height="79dp"
android:layout_marginTop="60dp"
android:background="#android:color/transparent"
android:scaleType="fitXY"
android:src="#drawable/menu6" />
<ImageButton
android:id="#+id/menu7"
android:layout_width="60dip"
android:layout_height="86dip"
android:layout_marginLeft="5dp"
android:layout_marginTop="60dp"
android:background="#android:color/transparent"
android:scaleType="fitStart"
android:src="#drawable/menu7" />
<ImageButton
android:id="#+id/menu8"
android:layout_width="75dip"
android:layout_height="50dip"
android:layout_centerVertical="true"
android:layout_marginRight="110dp"
android:layout_marginTop="80dp"
android:background="#android:color/transparent"
android:scaleType="fitXY"
android:src="#drawable/menu8" />
</TableRow>
<TableRow android:id="#+id/tableRow3" >
<ImageButton
android:id="#+id/menu9"
android:layout_width="60px"
android:layout_height="80px"
android:layout_marginLeft="2dp"
android:layout_marginTop="40dp"
android:background="#android:color/transparent"
android:scaleType="fitXY"
android:src="#drawable/menu9" />
<ImageButton
android:id="#+id/menu10"
android:layout_width="75dip"
android:layout_height="56dip"
android:layout_alignParentLeft="true"
android:layout_marginLeft="2dp"
android:layout_marginTop="70dp"
android:background="#android:color/transparent"
android:scaleType="fitXY"
android:src="#drawable/menu10" />
<ImageButton
android:id="#+id/menu11"
android:layout_width="75dip"
android:layout_height="65dip"
android:layout_alignParentLeft="true"
android:layout_marginLeft="2dp"
android:layout_marginTop="70dp"
android:background="#android:color/transparent"
android:scaleType="fitXY"
android:src="#drawable/menu11" />
<ImageButton
android:id="#+id/menu12"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_marginRight="100dp"
android:layout_marginTop="70dp"
android:background="#android:color/transparent"
android:scaleType="fitXY"
android:src="#drawable/menu12" />
</TableRow>
</TableLayout>
</RelativeLayout>
Change also the rule as relativeParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
Also add:
//change this.addContentView(adView, relativeParams); by
RelativeLayout rootView = (RelativeLayout)findViewById(R.id.rootview);
rootView.addView(adView, relativeParams);

Change your XML file like this:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="#drawable/mainbackgroundipad"
android:orientation="vertical" >
<TableRow android:id="#+id/tableRow1" >
<ImageButton
android:id="#+id/menu1"
android:layout_width="75dip"
android:layout_height="74dip"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginTop="57dp"
android:background="#android:color/transparent"
android:scaleType="fitXY"
android:src="#drawable/menu1" />
<ImageButton
android:id="#+id/menu2"
android:layout_width="75dp"
android:layout_height="59dp"
android:layout_marginLeft="5dp"
android:layout_marginTop="70dp"
android:background="#android:color/transparent"
android:scaleType="fitXY"
android:src="#drawable/menu2" />
<ImageButton
android:id="#+id/menu3"
android:layout_width="75dip"
android:layout_height="63dip"
android:layout_marginLeft="1dp"
android:layout_marginTop="70dp"
android:background="#android:color/transparent"
android:scaleType="fitXY"
android:src="#drawable/menu3" />
<ImageButton
android:id="#+id/menu4"
android:layout_width="60dp"
android:layout_height="83dp"
android:layout_marginRight="100dp"
android:layout_marginTop="50dp"
android:background="#android:color/transparent"
android:scaleType="fitCenter"
android:src="#drawable/menu4" />
</TableRow>
<TableRow android:id="#+id/tableRow2" >
<ImageButton
android:id="#+id/menu5"
android:layout_width="50dp"
android:layout_height="75dp"
android:layout_marginLeft="12dp"
android:layout_marginTop="60dp"
android:background="#android:color/transparent"
android:scaleType="fitXY"
android:src="#drawable/menu5" />
<ImageButton
android:id="#+id/menu6"
android:layout_width="60dp"
android:layout_height="79dp"
android:layout_marginTop="60dp"
android:background="#android:color/transparent"
android:scaleType="fitXY"
android:src="#drawable/menu6" />
<ImageButton
android:id="#+id/menu7"
android:layout_width="60dip"
android:layout_height="86dip"
android:layout_marginLeft="5dp"
android:layout_marginTop="60dp"
android:background="#android:color/transparent"
android:scaleType="fitStart"
android:src="#drawable/menu7" />
<ImageButton
android:id="#+id/menu8"
android:layout_width="75dip"
android:layout_height="50dip"
android:layout_centerVertical="true"
android:layout_marginRight="110dp"
android:layout_marginTop="80dp"
android:background="#android:color/transparent"
android:scaleType="fitXY"
android:src="#drawable/menu8" />
</TableRow>
<TableRow android:id="#+id/tableRow3" >
<ImageButton
android:id="#+id/menu9"
android:layout_width="60px"
android:layout_height="80px"
android:layout_marginLeft="2dp"
android:layout_marginTop="40dp"
android:background="#android:color/transparent"
android:scaleType="fitXY"
android:src="#drawable/menu9" />
<ImageButton
android:id="#+id/menu10"
android:layout_width="75dip"
android:layout_height="56dip"
android:layout_alignParentLeft="true"
android:layout_marginLeft="2dp"
android:layout_marginTop="70dp"
android:background="#android:color/transparent"
android:scaleType="fitXY"
android:src="#drawable/menu10" />
<ImageButton
android:id="#+id/menu11"
android:layout_width="75dip"
android:layout_height="65dip"
android:layout_alignParentLeft="true"
android:layout_marginLeft="2dp"
android:layout_marginTop="70dp"
android:background="#android:color/transparent"
android:scaleType="fitXY"
android:src="#drawable/menu11" />
<ImageButton
android:id="#+id/menu12"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_marginRight="100dp"
android:layout_marginTop="70dp"
android:background="#android:color/transparent"
android:scaleType="fitXY"
android:src="#drawable/menu12" />
</TableRow>
</TableLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/linear"
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="match_parent">
</LinearLayout>
</RelativeLayout>
And in java add your adview in the linearlayout.. Hope it must help you

Related

How to keep a button in a fixed place when adding lines to the TextView above?

In Android Studio I have a ScrollView and inside a layout with TextView, ImageView, another few objects and then a button.
In my app everytime you click on the button, the TextView adds another line (up to a limit), how can I prevent the button changing its place in the layout when adding a new line? (All of the objects except for one TextView and the button are Invisble).
Preview:
XML:
<?xml version="1.0" encoding="utf-8"?>
<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:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".GameActivity">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/levelTV"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Level 1"
android:textSize="14sp" />
<TextView
android:id="#+id/senTV"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:text="Sentence"
android:textSize="24sp"
android:textStyle="bold" />
<TextView
android:id="#+id/transTV"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Translation"
android:textAlignment="textStart"
android:textSize="24sp" />
<ImageView
android:id="#+id/pic"
android:layout_width="match_parent"
android:layout_height="130dp"
app:srcCompat="#android:drawable/btn_dialog" />
<EditText
android:id="#+id/picET"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="word in the pic"
android:minHeight="48dp" />
<ImageButton
android:id="#+id/backBtn"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_gravity="right"
app:srcCompat="#android:drawable/ic_input_delete"
tools:ignore="SpeakableTextPresentCheck"
android:onClick="back"/>
<com.google.android.material.chip.ChipGroup
android:id="#+id/bank"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
>
<com.google.android.material.chip.Chip
android:id="#+id/word1"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:tag="0"
android:text="word1"
android:textAlignment="center"
android:theme="#style/Theme.MaterialComponents.Light" />
<com.google.android.material.chip.Chip
android:id="#+id/word2"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:tag="1"
android:text="word2"
android:textAlignment="center"
android:theme="#style/Theme.MaterialComponents.Light" />
<com.google.android.material.chip.Chip
android:id="#+id/word3"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:tag="2"
android:textAlignment="center"
android:theme="#style/Theme.MaterialComponents.Light"
tools:text="word3" />
<com.google.android.material.chip.Chip
android:id="#+id/word4"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:tag="3"
android:text="word4"
android:textAlignment="center"
android:theme="#style/Theme.MaterialComponents.Light" />
<com.google.android.material.chip.Chip
android:id="#+id/word5"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:tag="4"
android:textAlignment="center"
android:theme="#style/Theme.MaterialComponents.Light"
tools:text="word5" />
<com.google.android.material.chip.Chip
android:id="#+id/word6"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:tag="5"
android:textAlignment="center"
android:theme="#style/Theme.MaterialComponents.Light"
tools:text="word6" />
<com.google.android.material.chip.Chip
android:id="#+id/word7"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:tag="6"
android:text="word7"
android:textAlignment="center"
android:theme="#style/Theme.MaterialComponents.Light" />
<com.google.android.material.chip.Chip
android:id="#+id/word8"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:tag="7"
android:text="word8"
android:textAlignment="center"
android:theme="#style/Theme.MaterialComponents.Light" />
<com.google.android.material.chip.Chip
android:id="#+id/word9"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:tag="8"
android:text="word9"
android:textAlignment="center" />
<com.google.android.material.chip.Chip
android:id="#+id/word10"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:tag="9"
android:text="word10"
android:textAlignment="center" />
<com.google.android.material.chip.Chip
android:id="#+id/word11"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:tag="10"
android:textAlignment="center"
tools:text="word11" />
<com.google.android.material.chip.Chip
android:id="#+id/word12"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:tag="11"
android:text="word12"
android:textAlignment="center" />
</com.google.android.material.chip.ChipGroup>
<Button
android:id="#+id/checkBtn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:backgroundTint="#80DEEA"
android:onClick="check"
android:text="הבא"
android:textSize="16sp"
android:textStyle="bold" />
</LinearLayout>
</ScrollView>
</LinearLayout

Gridlayout does not fill_parent evenly - Android / Java

I'm not sure exactly why this is happening but I've created a GridLayout in Android and it does not fill_parent evenly as expected. Most of the icons are smushed to the left - and are not evenly distributed.
Can anyone spot why this might be happening?
Screenshot:
XML:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/download"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/black"
android:weightSum="1" >
<RelativeLayout
android:id="#+id/rl_ListView2"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:background="#color/black" >
<RelativeLayout
android:id="#+id/rl_ListView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:adjustViewBounds="true"
android:gravity="left"
android:paddingBottom="65dp" />
<ImageView
android:id="#+id/background"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:gravity="right"
android:paddingBottom="65dp"
android:scaleType="fitXY" />
</RelativeLayout>
<ImageView
android:id="#+id/boxart"
android:layout_width="450dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:adjustViewBounds="true"
android:gravity="left"
android:paddingBottom="65dp" />
<RelativeLayout
android:id="#+id/rl_ListView2a"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingLeft="450dp"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:layout_alignParentTop="true" >
<GridLayout
android:id="#+id/GridLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="#+id/textView1"
android:layout_centerHorizontal="true"
android:columnCount="5"
android:columnWidth="300dip"
android:gravity="center"
android:horizontalSpacing="100dip"
android:numColumns="auto_fit"
android:orientation="vertical"
android:rowCount="6"
android:stretchMode="spacingWidthUniform"
android:verticalSpacing="100dip" >
<Switch
android:id="#+id/switch1"
android:layout_column="0"
android:layout_gravity="left|bottom"
android:layout_row="3" />
<Switch
android:id="#+id/switch2"
android:layout_column="1"
android:layout_gravity="left|bottom"
android:layout_row="3" />
<Switch
android:id="#+id/switch3"
android:layout_column="3"
android:layout_gravity="left|bottom"
android:layout_row="3" />
<ImageView
android:id="#+id/imageView7"
android:layout_width="50dp"
android:layout_height="100dp"
android:layout_column="1"
android:layout_gravity="center_horizontal|top"
android:layout_row="5"
android:src="#drawable/icon_shopping" />
<ImageView
android:id="#+id/imageView8"
android:layout_width="50dp"
android:layout_height="100dp"
android:layout_column="3"
android:layout_gravity="center_horizontal|top"
android:layout_row="5"
android:src="#drawable/icon_superfan" />
<Switch
android:id="#+id/switch4"
android:layout_column="4"
android:layout_gravity="left|bottom"
android:layout_row="3" />
<ImageView
android:id="#+id/imageView5"
android:layout_width="50dp"
android:layout_height="100dp"
android:layout_column="4"
android:layout_gravity="center_horizontal|top"
android:layout_row="3"
android:src="#drawable/icon_quotes" />
<ImageView
android:id="#+id/imageView4"
android:layout_width="50dp"
android:layout_height="100dp"
android:layout_column="3"
android:layout_gravity="center_horizontal|top"
android:layout_row="3"
android:src="#drawable/icon_plotinfo" />
<ImageView
android:id="#+id/imageView3"
android:layout_width="50dp"
android:layout_height="100dp"
android:layout_column="1"
android:layout_gravity="center_horizontal|top"
android:layout_row="3"
android:src="#drawable/icon_locations" />
<ImageView
android:id="#+id/imageView2"
android:layout_width="50dp"
android:layout_height="100dp"
android:layout_column="0"
android:layout_gravity="center_horizontal|top"
android:layout_row="3"
android:src="#drawable/icon_dilemmas" />
<ImageView
android:id="#+id/imageView12"
android:layout_margin="20dp"
android:layout_width="50dp"
android:layout_height="100dp"
android:layout_column="3"
android:layout_gravity="center_horizontal|top"
android:layout_row="1"
android:src="#drawable/icon_vehicles_top_center" />
<ImageView
android:id="#+id/imageView13"
android:layout_margin="20dp"
android:layout_width="50dp"
android:layout_height="100dp"
android:layout_column="4"
android:layout_gravity="center_horizontal|top"
android:layout_row="1"
android:src="#drawable/icon_weapons_top_center" />
<ImageView
android:id="#+id/imageView6"
android:layout_width="50dp"
android:layout_height="100dp"
android:layout_column="0"
android:layout_gravity="center_horizontal|top"
android:layout_row="5"
android:src="#drawable/icon_recipe" />
<ImageView
android:id="#+id/imageView9"
android:layout_width="50dp"
android:layout_height="100dp"
android:layout_column="4"
android:layout_gravity="center_horizontal|top"
android:layout_row="5"
android:src="#drawable/icon_trivia" />
<Switch
android:id="#+id/switch8"
android:layout_column="4"
android:layout_gravity="left|bottom"
android:layout_row="5" />
<Switch
android:id="#+id/switch7"
android:layout_column="3"
android:layout_gravity="left|bottom"
android:layout_row="5" />
<Switch
android:id="#+id/switch6"
android:layout_column="1"
android:layout_gravity="left|bottom"
android:layout_row="5" />
<Switch
android:id="#+id/switch5"
android:layout_column="0"
android:layout_gravity="left|bottom"
android:layout_row="5" />
<ImageView
android:id="#+id/imageView10"
android:layout_width="50dp"
android:layout_height="100dp"
android:layout_margin="20dp"
android:layout_column="0"
android:layout_gravity="center|bottom"
android:layout_row="1"
android:src="#drawable/icon_music_top_center" />
<ImageView
android:id="#+id/imageView11"
android:layout_margin="20dp"
android:layout_width="50dp"
android:layout_height="100dp"
android:layout_column="1"
android:layout_gravity="center_horizontal|top"
android:layout_row="1"
android:src="#drawable/icon_who_top_center" />
</GridLayout>
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:text="On Demand"
android:textAppearance="?android:attr/textAppearanceLarge" />
</RelativeLayout>
<LinearLayout
android:id="#+id/footer"
android:layout_width="fill_parent"
android:layout_height="80dp"
android:layout_alignParentBottom="true"
android:background="#drawable/timeline_bottom_android"
android:orientation="horizontal" >
<ImageView
android:id="#+id/backbtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:gravity="left"
android:src="#drawable/icon_back_arrow" />
<TextView
android:id="#+id/backButtonTxt"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_alignRight="#+id/saveButton"
android:gravity="center_vertical"
android:text="Movies"
android:textSize="40sp" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
android:layout_gravity="center_horizontal|top" should be android:layout_gravity="left|bottom" for imageView9 (etc)

Need help aligning buttons to bottom

Here is what it looks like currently:
http://i.stack.imgur.com/eaBpP.png
I want buttons to go and align at bottom (and cover all screen from sides too). I try to do this but getting unexpected results. Here is layout code:
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#000000" >
<GridLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:columnCount="3" >
<TextView
android:id="#+id/result"
android:layout_width="238dp"
android:layout_height="wrap_content"
android:layout_column="0"
android:layout_gravity="left"
android:layout_marginRight="40dp"
android:layout_row="0"
android:gravity="right"
android:text=""
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#FFFF00"
android:textSize="35sp"
android:textStyle="bold" />
<Space
android:layout_width="271dp"
android:layout_height="1dp"
android:layout_column="0"
android:layout_row="0" />
<ImageButton
android:id="#+id/clear"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_column="1"
android:layout_columnSpan="2"
android:layout_gravity="left"
android:layout_row="1"
android:layout_rowSpan="2"
android:paddingLeft="4dp"
android:src="#android:drawable/ic_input_delete" />
<Space
android:layout_width="12dp"
android:layout_height="15dp"
android:layout_column="2"
android:layout_row="1" />
<Space
android:layout_width="100dp"
android:layout_height="14dp"
android:layout_column="0"
android:layout_row="2" />
<Space
android:layout_width="100dp"
android:layout_height="13dp"
android:layout_row="2" />
</GridLayout>
<TableRow
android:id="#+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="30dp"
android:gravity="center" >
<Button
android:id="#+id/seven"
android:layout_width="80dp"
android:layout_height="100dp"
android:text="7"
android:textSize="50sp" />
<Button
android:id="#+id/eight"
android:layout_width="80dp"
android:layout_height="100dp"
android:text="8"
android:textSize="50sp" />
<Button
android:id="#+id/nine"
android:layout_width="80dp"
android:layout_height="100dp"
android:text="9"
android:textSize="50sp" />
<Button
android:id="#+id/divide"
style="#dimen/activity_horizontal_margin"
android:layout_width="80dp"
android:layout_height="100dp"
android:text="/"
android:textSize="50sp" />
</TableRow>
<TableRow
android:id="#+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center" >
<Button
android:id="#+id/four"
android:layout_width="wrap_content"
android:layout_height="100dp"
android:text="4"
android:textSize="50sp" />
<Button
android:id="#+id/five"
android:layout_width="wrap_content"
android:layout_height="100dp"
android:text="5"
android:textSize="50sp" />
<Button
android:id="#+id/six"
android:layout_width="wrap_content"
android:layout_height="100dp"
android:text="6"
android:textSize="50sp" />
<Button
android:id="#+id/multiply"
android:layout_width="wrap_content"
android:layout_height="100dp"
android:text="x"
android:textSize="50sp" />
</TableRow>
<TableRow
android:id="#+id/tableRow9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center" >
<Button
android:id="#+id/one"
android:layout_width="wrap_content"
android:layout_height="100dp"
android:text="1"
android:textSize="50sp" />
<Button
android:id="#+id/two"
android:layout_width="wrap_content"
android:layout_height="100dp"
android:text="2"
android:textSize="50sp" />
<Button
android:id="#+id/three"
android:layout_width="wrap_content"
android:layout_height="100dp"
android:text="3"
android:textSize="50sp" />
<Button
android:id="#+id/minus"
android:layout_width="wrap_content"
android:layout_height="100dp"
android:text="-"
android:textSize="50sp" />
</TableRow>
<TableRow
android:id="#+id/tableRow14"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center" >
<Button
android:id="#+id/dot"
android:layout_width="wrap_content"
android:layout_height="100dp"
android:text="."
android:textSize="50sp" />
<Button
android:id="#+id/zero"
android:layout_width="wrap_content"
android:layout_height="100dp"
android:text="0"
android:textSize="50sp" />
<Button
android:id="#+id/equals"
android:layout_width="wrap_content"
android:layout_height="100dp"
android:text="="
android:textSize="50sp" />
<Button
android:id="#+id/plus"
android:layout_width="wrap_content"
android:layout_height="100dp"
android:text="+"
android:textSize="50sp" />
</TableRow>
</TableLayout>
Try this code to make the Numbers Grid covering the side spaces and the bottom space.Checkout if it is required o/p.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#000000" >
<GridLayout
android:id="#+id/grid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:columnCount="3" >
<TextView
android:id="#+id/result"
android:layout_width="238dp"
android:layout_height="wrap_content"
android:layout_column="0"
android:layout_gravity="left"
android:layout_marginRight="40dp"
android:layout_row="0"
android:gravity="right"
android:text=""
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#FFFF00"
android:textSize="35sp"
android:textStyle="bold" />
<Space
android:layout_width="271dp"
android:layout_height="1dp"
android:layout_column="0"
android:layout_row="0" />
<ImageButton
android:id="#+id/clear"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_column="1"
android:layout_columnSpan="2"
android:layout_gravity="left"
android:layout_row="1"
android:layout_rowSpan="2"
android:paddingLeft="4dp"
android:src="#android:drawable/ic_input_delete" />
<Space
android:layout_width="12dp"
android:layout_height="15dp"
android:layout_column="2"
android:layout_row="1" />
<Space
android:layout_width="100dp"
android:layout_height="14dp"
android:layout_column="0"
android:layout_row="2" />
<Space
android:layout_width="100dp"
android:layout_height="13dp"
android:layout_row="2" />
</GridLayout>
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_below="#id/grid"
android:gravity="bottom" >
<TableRow
android:id="#+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="30dp"
android:gravity="center" >
<Button
android:id="#+id/seven"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_weight="1"
android:text="7"
android:textSize="50sp" />
<Button
android:id="#+id/eight"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_weight="1"
android:text="8"
android:textSize="50sp" />
<Button
android:id="#+id/nine"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_weight="1"
android:text="9"
android:textSize="50sp" />
<Button
android:id="#+id/divide"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_weight="1"
android:text="/"
android:textSize="50sp" />
</TableRow>
<TableRow
android:id="#+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center" >
<Button
android:id="#+id/four"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_weight="1"
android:text="4"
android:textSize="50sp" />
<Button
android:id="#+id/five"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_weight="1"
android:text="5"
android:textSize="50sp" />
<Button
android:id="#+id/six"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_weight="1"
android:text="6"
android:textSize="50sp" />
<Button
android:id="#+id/multiply"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_weight="1"
android:text="x"
android:textSize="50sp" />
</TableRow>
<TableRow
android:id="#+id/tableRow9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center" >
<Button
android:id="#+id/one"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_weight="1"
android:text="1"
android:textSize="50sp" />
<Button
android:id="#+id/two"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_weight="1"
android:text="2"
android:textSize="50sp" />
<Button
android:id="#+id/three"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_weight="1"
android:text="3"
android:textSize="50sp" />
<Button
android:id="#+id/minus"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_weight="1"
android:text="-"
android:textSize="50sp" />
</TableRow>
<TableRow
android:id="#+id/tableRow14"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center" >
<Button
android:id="#+id/dot"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_weight="1"
android:text="."
android:textSize="50sp" />
<Button
android:id="#+id/zero"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_weight="1"
android:text="0"
android:textSize="50sp" />
<Button
android:id="#+id/equals"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_weight="1"
android:text="="
android:textSize="50sp" />
<Button
android:id="#+id/plus"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_weight="1"
android:text="+"
android:textSize="50sp" />
</TableRow>
</TableLayout>
I add some sample code. Try to use this. It is just sample code....
<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="match_parent"
android:background="#fff"
android:orientation="vertical"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".Home" >
<EditText
android:id="#+id/display"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_gravity="center"
android:gravity="center"
android:orientation="horizontal"
android:paddingTop="20dp" >
<Button
android:id="#+id/seven"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:text="7"
/>
<Button
android:id="#+id/eight"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:text="8" />
<Button
android:id="#+id/nine"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:text="9" />
<Button
android:id="#+id/div"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:text="/" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_weight="1"
android:layout_gravity="center"
android:gravity="center"
android:orientation="horizontal"
android:paddingTop="20dp"
android:layout_height="0dp" >
<Button
android:id="#+id/four"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:text="4" />
<Button
android:id="#+id/five"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:text="5" />
<Button
android:id="#+id/six"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:text="6" />
<Button
android:id="#+id/mul"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:text="*" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_weight="1"
android:layout_gravity="center"
android:gravity="center"
android:orientation="horizontal"
android:paddingTop="20dp"
android:layout_height="0dp">
<Button
android:id="#+id/one"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:text="1" />
<Button
android:id="#+id/two"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:text="2" />
<Button
android:id="#+id/three"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:text="3" />
<Button
android:id="#+id/sub"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:text="-" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_weight="1"
android:layout_gravity="center"
android:gravity="center"
android:orientation="horizontal"
android:paddingTop="20dp"
android:layout_height="0dp">
<Button
android:id="#+id/cancel"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:text="c" />
<Button
android:id="#+id/zero"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:text="0" />
<Button
android:id="#+id/equal"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:text="=" />
<Button
android:id="#+id/add"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:text="+" />
</LinearLayout>
</LinearLayout>

Android: Changing targetSdkVersion from 15 to 18 effects the layout view

Changing the TargetSdk version in the Android Manifest.xml file from 15 to 18 affects the height of the Linearlayout. Actually the height of the Linearlayout is getting increased with the change of TargetSdk.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/footer"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingTop="3dp"
android:layout_margin="0dp"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
android:orientation="horizontal"
android:background="#drawable/border">
<ImageButton
android:clickable="true"
android:id="#+id/f_rewards"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="center"
android:adjustViewBounds="true"
android:layout_margin="0dp"
android:padding="10dp"
android:layout_alignParentRight="true"
android:layout_weight=".33"
android:background="#drawable/border_left_footer"
android:src="#drawable/rewards_f"
/>
<ImageButton
android:clickable="true"
android:id="#+id/f_scan"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="center"
android:adjustViewBounds="true"
android:layout_margin="0dp"
android:padding="10dp"
android:layout_alignParentRight="true"
android:layout_weight=".33"
android:background="#drawable/border_left_footer"
android:src="#drawable/scan_f"
/>
<ImageButton
android:clickable="true"
android:id="#+id/f_check_in"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="center"
android:adjustViewBounds="true"
android:layout_margin="0dp"
android:padding="10dp"
android:layout_alignParentRight="true"
android:layout_weight=".33"
android:background="#drawable/border_left_footer"
android:src="#drawable/check_in_f"
/>
</LinearLayout>
okay, ive found the solution, the solution was to remove " android:adjustViewBounds="true" from ImageButton and it works :) The new xml would be this
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/footer"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingTop="3dp"
android:orientation="horizontal"
android:layout_margin="0dp"
android:layout_alignParentBottom="true"
android:background="#drawable/border">
<ImageButton
android:clickable="true"
android:id="#+id/f_rewards"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="center"
android:layout_margin="0dp"
android:padding="10dp"
android:layout_weight=".33"
android:background="#drawable/border_left_footer"
android:src="#drawable/rewards_f"
/>
<ImageButton
android:id="#+id/f_scan"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="0dp"
android:layout_weight=".33"
android:background="#drawable/border_left_footer"
android:clickable="true"
android:padding="10dp"
android:scaleType="center"
android:src="#drawable/scan_f" />
<ImageButton
android:clickable="true"
android:id="#+id/f_check_in"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="center"
android:layout_margin="0dp"
android:padding="10dp"
android:layout_weight=".33"
android:background="#drawable/border_left_footer"
android:src="#drawable/check_in_f"
/>
</LinearLayout>

Landscape mode: why do I get different result on my computer screen and different on my phone?

This is the first time I'm making an activity xml in landscape model. Until now, what I saw on my computer screen that was what I got on my phone. Now, it's not even close! I placed some layouts, buttons and stuff, centered them like I need them, and tried on the phone and some stuff are way off the screen, some stuff are moved to the right, nothing is like I made it in my xml. So I have to move some stuff a little, then try it on my phone, without any order or rule. Why is this happening?
<?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"
android:background="#drawable/backgroundland" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="4" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1" >
<Button
android:id="#+id/bA1"
android:layout_width="115dp"
android:background="#drawable/buttons"
android:textSize="18sp"
android:textColor="#ffffff"
android:padding="0dp"
android:layout_margin="3dp"
android:layout_height="35dp"
android:text="A1" />
<Button
android:id="#+id/bA2"
android:layout_width="115dp"
android:background="#drawable/buttons"
android:textSize="18sp"
android:textColor="#ffffff"
android:padding="0dp"
android:layout_margin="3dp"
android:layout_height="35dp"
android:text="A2" />
<Button
android:id="#+id/bA3"
android:layout_width="115dp"
android:background="#drawable/buttons"
android:textSize="18sp"
android:textColor="#ffffff"
android:padding="0dp"
android:layout_margin="3dp"
android:layout_height="35dp"
android:text="A3" />
<Button
android:id="#+id/bA4"
android:layout_width="115dp"
android:background="#drawable/buttons"
android:textSize="18sp"
android:textColor="#ffffff"
android:padding="0dp"
android:layout_margin="3dp"
android:layout_height="35dp"
android:text="A4" />
<Button
android:id="#+id/bKolonaA"
android:layout_width="115dp"
android:background="#drawable/buttons"
android:textSize="19sp"
android:textColor="#ffffff"
android:padding="0dp"
android:layout_margin="3dp"
android:layout_height="35dp"
android:text="Kolona A" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="1" >
<Button
android:id="#+id/bB1"
android:layout_width="115dp"
android:background="#drawable/buttons"
android:textSize="18sp"
android:textColor="#ffffff"
android:padding="0dp"
android:layout_margin="3dp"
android:layout_height="35dp"
android:text="B1" />
<Button
android:id="#+id/bB2"
android:layout_width="115dp"
android:background="#drawable/buttons"
android:textSize="18sp"
android:textColor="#ffffff"
android:padding="0dp"
android:layout_margin="3dp"
android:layout_height="35dp"
android:text="B2" />
<Button
android:id="#+id/bB3"
android:layout_width="115dp"
android:background="#drawable/buttons"
android:textSize="18sp"
android:textColor="#ffffff"
android:padding="0dp"
android:layout_margin="3dp"
android:layout_height="35dp"
android:text="B3" />
<Button
android:id="#+id/bB4"
android:layout_width="115dp"
android:background="#drawable/buttons"
android:textSize="18sp"
android:textColor="#ffffff"
android:padding="0dp"
android:layout_margin="3dp"
android:layout_height="35dp"
android:text="B4" />
<Button
android:id="#+id/bKolonaB"
android:layout_width="115dp"
android:background="#drawable/buttons"
android:textSize="19sp"
android:textColor="#ffffff"
android:padding="0dp"
android:layout_margin="3dp"
android:layout_height="35dp"
android:text="Kolona B" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1" >
<Button
android:id="#+id/bC1"
android:layout_width="115dp"
android:background="#drawable/buttons"
android:textSize="18sp"
android:textColor="#ffffff"
android:padding="0dp"
android:layout_margin="3dp"
android:layout_height="35dp"
android:text="C1" />
<Button
android:id="#+id/bC2"
android:layout_width="115dp"
android:background="#drawable/buttons"
android:textSize="18sp"
android:textColor="#ffffff"
android:padding="0dp"
android:layout_margin="3dp"
android:layout_height="35dp"
android:text="C2" />
<Button
android:id="#+id/bC3"
android:layout_width="115dp"
android:background="#drawable/buttons"
android:textSize="18sp"
android:textColor="#ffffff"
android:padding="0dp"
android:layout_margin="3dp"
android:layout_height="35dp"
android:text="C3" />
<Button
android:id="#+id/bC4"
android:layout_width="115dp"
android:layout_height="35dp"
android:layout_margin="3dp"
android:background="#drawable/buttons"
android:padding="0dp"
android:text="C4"
android:textColor="#ffffff"
android:textSize="18sp" />
<Button
android:id="#+id/bKolonaC"
android:layout_width="115dp"
android:background="#drawable/buttons"
android:textSize="19sp"
android:textColor="#ffffff"
android:padding="0dp"
android:layout_margin="3dp"
android:layout_height="35dp"
android:text="Kolona C" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1" >
<Button
android:id="#+id/bD1"
android:layout_width="115dp"
android:background="#drawable/buttons"
android:textSize="18sp"
android:textColor="#ffffff"
android:padding="0dp"
android:layout_margin="3dp"
android:layout_height="35dp"
android:text="D1" />
<Button
android:id="#+id/bD2"
android:layout_width="115dp"
android:background="#drawable/buttons"
android:textSize="18sp"
android:textColor="#ffffff"
android:padding="0dp"
android:layout_margin="3dp"
android:layout_height="35dp"
android:text="D2" />
<Button
android:id="#+id/bD3"
android:layout_width="115dp"
android:background="#drawable/buttons"
android:textSize="18sp"
android:textColor="#ffffff"
android:padding="0dp"
android:layout_margin="3dp"
android:layout_height="35dp"
android:text="D3" />
<Button
android:id="#+id/bD4"
android:layout_width="115dp"
android:background="#drawable/buttons"
android:textSize="18sp"
android:textColor="#ffffff"
android:padding="0dp"
android:layout_margin="3dp"
android:layout_height="35dp"
android:text="D4" />
<Button
android:id="#+id/bKolonaD"
android:layout_width="115dp"
android:background="#drawable/buttons"
android:textSize="19sp"
android:textColor="#ffffff"
android:padding="0dp"
android:layout_margin="3dp"
android:layout_height="35dp"
android:text="Kolona D" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="120dp"
android:layout_height="wrap_content" >
<Button
android:id="#+id/bIzlazA"
android:layout_width="50dp"
android:layout_height="35dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="3dp"
android:background="#drawable/buttons_final"
android:padding="0dp"
android:text=""
android:textColor="#ffffff"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:layout_width="280dp"
android:layout_height="wrap_content" >
<Button
android:id="#+id/bKonacno"
android:layout_width="260dp"
android:layout_height="35dp"
android:layout_marginTop="3dp"
android:background="#drawable/buttons_final"
android:padding="0dp"
android:text=""
android:textColor="#ffffff"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:layout_width="100dp"
android:layout_height="match_parent" >
<TextView
android:id="#+id/tvVreme"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginTop="8dp"
android:text="100"
android:textColor="#ff0000"
android:textSize="20sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
what i know is that the emulator doesn't work same as real devices so why don't you us your phone in debug mode to see what your code really do.
post your code may be we can see if it's not the emulator problem
EDIT:
just add android:layoutweight="1" to the 3 lyouts at the bottom
you should have better results :)
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="120dp"
android:layout_weight="1"
android:layout_height="wrap_content" >
<Button
android:id="#+id/bIzlazA"
android:layout_width="50dp"
android:layout_height="35dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="3dp"
android:background="#drawable/ic_launcher"
android:padding="0dp"
android:text=""
android:textColor="#ffffff"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:layout_width="280dp"
android:layout_weight="1"
android:layout_height="wrap_content" >
<Button
android:id="#+id/bKonacno"
android:layout_width="260dp"
android:layout_height="35dp"
android:layout_marginTop="3dp"
android:background="#drawable/ic_launcher"
android:padding="0dp"
android:textColor="#ffffff"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:layout_width="100dp"
android:layout_weight="1"
android:layout_height="match_parent" >
<TextView
android:id="#+id/tvVreme"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginTop="8dp"
android:text="100"
android:textColor="#ff0000"
android:textSize="20sp" />
</LinearLayout>
</LinearLayout>
Probably different resolutions on emulator and on device, and you didn't used dpi but pixels.
Also it can be a problem when using absolute layout.
Hard to gues without the code

Categories

Resources