小编Rav*_*dra的帖子

android.view.InflateException:二进制XML文件行#2:错误膨胀类<unknown>

我正在开发一个简单的应用程序 刚刚完成主屏幕.如果方向变化超过两次,则抛出错误并且应用程序强制关闭.

我的活动代码:

public class PasswordActivity extends Activity implements OnClickListener {
Button login;  
Button forgot;
Button register;  

private static final String PREFERENCES = "prefs";
private static final String PREFERENCES_NAME = "pref_name"; 
SharedPreferences settings;
private Cursor c;

@Override 
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main); 
    login=(Button)findViewById(R.id.login_login);
    login.setOnClickListener(this);
    register=(Button)findViewById(R.id.login_register);
    register.setOnClickListener(this);

}
public void onClick(View v) {
}

}
Run Code Online (Sandbox Code Playgroud)

我的Xml代码:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"    
android:background="@drawable/listpic"
>

<LinearLayout 
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="5dp"
android:paddingLeft="3dp"
android:paddingRight="3dp"
>  
<TextView 
 android:layout_width="fill_parent"
 android:layout_weight="0.75"
 android:layout_height="wrap_content"
 android:text="@string/login_user_name" …
Run Code Online (Sandbox Code Playgroud)

android android-emulator android-memory

22
推荐指数
1
解决办法
5万
查看次数

标签 统计

android ×1

android-emulator ×1

android-memory ×1