Answer the question
In order to leave comments, you need to log in
App not showing on screen on Android?
I'm just a schoolboy learning java and I met a problem when developing an application the
problem is that the application does not want to be displayed on the screen of my phone
although it is displayed on the preview screen in AS
here is my XML code:
<?xml version="1.0" encoding="utf-8"?>
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.mafcv.MainActivity">
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/etP"
android:layout_width="133dp"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textPersonName"
android:text="Name" />
<Button
android:id="@+id/btn1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="@+id/btn2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
</TableRow>
<TableRow
android:layout_width="166dp"
android:layout_height="11dp">
<Button
android:id="@+id/btna"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="@+id/btnb"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="@+id/btnc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
</TableRow>
<TableRow
android:layout_width="312dp"
android:layout_height="58dp">
<TextView
android:id="@+id/textView"
android:layout_width="206dp"
android:layout_height="40dp"
android:text="TextView"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:text="TextView"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="@+id/textView6"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:text="TextView"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="@+id/textView7"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:text="TextView"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
</TableRow>
</TableLayout>
ckage com.example.mafcv;
import android.support.constraint.ConstraintLayout;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.Switch;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity implements View.OnClickListener{
Button b1;
Button b2;
Button ba;
Button bb;
Button bc;
EditText et;
TextView tv;
TextView tvD;
TextView tvX1;
TextView tvX2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
et=(EditText) findViewById(R.id.etP);
b1=(Button) findViewById(R.id.btn1);
b2=(Button) findViewById(R.id.btn2);
ba=(Button) findViewById(R.id.btna);
bb=(Button) findViewById(R.id.btnb);
bc=(Button) findViewById(R.id.btnc);
}
public void onClick(View v) {
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question