• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Another problem while designing UI...

iggy23

Newbie
So i haave just dragged the buttons on the activity_main ....

Java:
this here is mainActivity.java:


package com.example.egids.bethehistory_basketball;

import android.app.Activity;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;

public class MainActivity extends Activity {

    // Used to load the 'native-lib' library on application startup.
    static {
        System.loadLibrary("native-lib");
    }

    [USER=1021285]@override[/USER]
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // Example of a call to a native method
        TextView tv = (TextView) findViewById(R.id.activity_main);
        tv.setText(stringFromJNI());
    }

    /**
     * A native method that is implemented by the 'native-lib' native library,
     * which is packaged with this application.
     */
    public native String stringFromJNI();
}






This is activity_main


<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="[URL]http://schemas.android.com/apk/res/android[/URL]"
    xmlns:tools="[URL]http://schemas.android.com/tools[/URL]"
    android:id="@+id/activity_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    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="com.example.egids.bethehistory_basketball.MainActivity"
    android:background="@android:drawable/alert_dark_frame">

    <Button
        android:text="Custom teams"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/button"
        android:layout_below="@+id/button5"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="65dp"
        android:background="?android:attr/colorBackgroundFloating" />

    <Button
        android:text="Credits"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/button3"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_marginLeft="20dp"
        android:layout_marginStart="20dp"
        android:layout_marginBottom="31dp"
        android:background="?android:attr/colorBackgroundFloating"
        android:backgroundTint="@android:color/white" />

    <Button
        android:text="Start The Journey"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/button5"
        android:background="?android:attr/colorBackgroundFloating"
        android:layout_marginTop="30dp"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true" />

    <Button
        android:text="Quit"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/button4"
        android:layout_marginTop="48dp"
        android:background="?android:attr/colorBackgroundFloating"
        android:layout_below="@+id/button2"
        android:layout_alignRight="@+id/button"
        android:layout_alignEnd="@+id/button" />

    <Button
        android:text="View Rosters"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/button2"
        android:layout_marginTop="78dp"
        android:background="?android:attr/colorBackgroundFloating"
        android:layout_below="@+id/button"
        android:layout_centerHorizontal="true" />
</RelativeLayout>
 
Back
Top Bottom