有致命的例外无法理解原因

时间:2016-02-09 10:33:14

标签: java android xml fatal-error

我一直在处理一个项目,我成功地在布局文件中进行了更改并运行项目。它在没有显示任何错误的情况下获得Build。

这是LogCat Trace:

package com.blues.app;

import android.app.Activity;
import android.os.Bundle;
import android.view.Window;
import android.widget.EditText;
import android.widget.ProgressBar;

/**
 * Created by iSandeep on 2/9/2016.
 */
public class Login_Activity extends Activity {

    EditText Username,Password;
    ProgressBar login_Progress;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);
    }
}

活动类

<RelativeLayout 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="@drawable/my_shape"
    android:padding="16dp"
    tools:context="com.blues.app.Login_Activity">

    <FrameLayout
        android:id="@+id/Header"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:padding="16dp">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal|center_vertical"
            android:textColor="#000000"
            android:text="SkyEdu"
            android:textSize="34dp"/>

    </FrameLayout>

    <ScrollView
        android:id="@+id/login_form"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/Header"
        android:layout_marginTop="@dimen/abc_action_bar_default_height_material">

        <LinearLayout
            android:id="@+id/llMyLinearLayout"
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <TextView
                android:id="@+id/tvLbl"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textColor="#000000"
                android:textSize="?android:attr/textAppearanceMedium"
                android:text="Username"/>

            <EditText
                android:id="@+id/email"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:theme="@style/AppTheme"
                android:inputType="text"
                android:padding="10dp"
                android:hint="Your Username"/>

            <TextView
                android:id="@+id/tvLblPass"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textColor="#000000"
                android:layout_marginTop="10dp"
                android:textSize="?android:attr/textAppearanceMedium"
                android:text="Password"/>

            <EditText
                android:id="@+id/password"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:imeActionId="@+id/login"
                android:theme="@style/AppTheme"
                android:inputType="textPassword"
                android:padding="10dp"
                android:hint="Your Password"/>

            <!-- Login progress -->
            <ProgressBar
                android:id="@+id/login_progress"
                style="?android:attr/progressBarStyleHorizontal"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="8dp"
                android:layout_marginTop="20dp"
                android:visibility="gone" />

            <Button
                android:id="@+id/email_sign_in_button"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textColor="#2196f3"
                android:layout_gravity="center_horizontal"
                android:layout_margin="20dp"
                android:padding="20dp"
                android:textSize="20sp"
                style="?android:attr/borderlessButtonStyle"
                android:text="SIGN IN"/>

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:textColor="#000000"
                android:layout_marginTop="20dp"
                android:text="NextSky Technologies Pvt. Ltd."/>
        </LinearLayout>

    </ScrollView>

    <!--<ScrollView android:id="@+id/login_form"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:visibility="visible"
        android:theme="@android:style/Theme.Translucent">

        <LinearLayout android:id="@+id/email_login_form"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="#ffffffff"
            android:layout_marginLeft="@dimen/pageMargin"
            android:layout_marginRight="@dimen/pageMargin"
            android:paddingBottom="@dimen/pageMargin"
            android:padding="@dimen/pageMargin"
            android:orientation="vertical"
            android:gravity="center_horizontal|center_vertical">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="start"
                android:visibility="gone"
                android:text="@string/Chk"/>
            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:contentDescription="@string/app_name"
                android:background="@drawable/main_img"/>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/minerMargin"
                android:gravity="center_horizontal">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:background="@color/whiteBg"
                    android:text="@string/LoginHeader"
                    android:textStyle="bold"
                    android:textSize="@dimen/textSize"/>

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:background="@color/whiteBg"
                    android:layout_marginLeft="5dp"
                    android:layout_marginStart="5dp"
                    android:text="@string/LoginHeader1"
                    android:textSize="@dimen/textSize"/>

            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:gravity="center_horizontal">

                <AutoCompleteTextView android:id="@+id/email"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:maxLines="1"
                    android:singleLine="true"
                    android:textCursorDrawable="@drawable/cursor"
                    android:background="@drawable/abc_popup_background_mtrl_mult"
                    android:hint="@string/Username"
                    android:padding="@dimen/LoginTextBoxPadding"
                    android:textSize="@dimen/textSize"
                    android:textColor="#000000"
                    android:text=""
                    android:layout_marginLeft="@dimen/minerMargin"
                    android:layout_marginRight="@dimen/minerMargin" />

                <EditText android:id="@+id/password"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="@string/prompt_password"
                    android:imeActionId="@+id/login"
                    android:textCursorDrawable="@drawable/cursor"
                    android:imeActionLabel="@string/action_sign_in_short"
                    android:imeOptions="actionUnspecified"
                    android:inputType="textPassword"
                    android:text=""
                    android:maxLines="1"
                    android:textColor="#000000"
                    android:singleLine="true"
                    android:background="@drawable/abc_popup_background_mtrl_mult"
                    android:padding="@dimen/LoginTextBoxPadding"
                    android:textSize="@dimen/textSize"
                    android:layout_marginLeft="@dimen/minerMargin"
                    android:layout_marginRight="@dimen/minerMargin"/>

                <Button android:id="@+id/email_sign_in_button"
                    android:text="@string/btnLogin"
                    android:textColor="@color/BtnTextColor"
                    android:textAllCaps="false"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:background="@drawable/login_button"
                    android:shadowColor="#A8A8A8"
                    android:shadowDx="0"
                    android:shadowDy="0"
                    android:shadowRadius="5"
                    android:textAppearance="?android:attr/textAppearanceMedium"
                    android:layout_marginTop="@dimen/minerMargin"
                    android:layout_marginRight="@dimen/minerMargin"
                    android:layout_marginEnd="@dimen/minerMargin"
                    android:layout_gravity="end"/>
            </LinearLayout>
        </LinearLayout>
    </ScrollView>-->
</RelativeLayout>

Xml布局activity_login

Private Sub btnUpdateHeight_Click(sender As System.Object, e As System.EventArgs) Handles btnUpdateHeight.Click
    dt = loadform()
    ProgressBarTSLabels.Minimum = 0
    Dim qty As Integer = 0
    ProgressBarTSLabels.Value = 0
    ProgressBarTSLabels.Maximum = dt.Rows.Count
    Dim db As New DataClasses1DataContext
    For Each Me.dr In dt.Rows
        If dr.Item(5).ToString.Trim <> "" Then
            Dim sqlupdate As tblLabel = (From expr In db.tblLabels Where expr.LabelID = dr.Item(0).ToString).First
            With sqlupdate
                .Height = If(dr.Item(5).ToString = "max", "999", dr.Item(5).ToString)
                db.SubmitChanges()
            End With
        End If
        ProgressBarTSLabels.Value += 1
        qty += 1
        lblQty.Text = qty & "/" & dt.Rows.Count
    Next
End Sub

直到现在,我已经尝试过清理并构建,为同一任务创建新活动。但它给出了同样的例外。

如果您需要任何其他信息,请在评论中提及。谢谢。

3 个答案:

答案 0 :(得分:2)

试试这个:

替换

android:layout_marginTop="@dimen/abc_action_bar_default_height_material"

android:layout_marginTop="10dp"

有关详细信息,请访问 this链接

答案 1 :(得分:1)

此:

android:textSize="?android:attr/textAppearanceMedium"

不是有效的textSize。用有效的文本大小替换,即14sp或使用:

android:textAppearance="?android:attr/textAppearanceMedium"

答案 2 :(得分:0)

感谢@AndroidDev和@jvrodrigues的答案,我将你的答案结合起来,现在工作正常。