我有个简单的layout
<?xml version="1.0" encoding="utf-8"?>
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mylayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TableRow >
<TextView
android:id="@+id/id"
android:textSize="30px"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/name"
android:textSize="30px"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</TableRow>
</TableLayout>
然后private LinearLayout layout = null;
this.layout =(LinearLayout)findViewById(R.id.mylayout);
调用的话layout =null;换成tablelayout的类型也不行跪求大神
<?xml version="1.0" encoding="utf-8"?>
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mylayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TableRow >
<TextView
android:id="@+id/id"
android:textSize="30px"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/name"
android:textSize="30px"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</TableRow>
</TableLayout>
然后private LinearLayout layout = null;
this.layout =(LinearLayout)findViewById(R.id.mylayout);
调用的话layout =null;换成tablelayout的类型也不行跪求大神
super.setContentView(R.layout.activity_main);
this.layout =(TableLayout)findViewById(R.id.myTableLayout);
if(MainActivity.this.layout !=null){
Dialog dialog = new AlertDialog.Builder(this).setMessage("ok").show();
}else{
Dialog dialog = new AlertDialog.Builder(this).setMessage("出错了").show();
}
我这样都不行