伙计我有代码来显示图像/可绘制。我一直收到错误“无法解析符号页面”我确信我复杂的问题在这里很少有必须有一个更简单的方法来做到这一点。我正在使用http://www.learn-android-easily.com/2013/07/android-expandablelistview-example.html
中的示例package com.geka.deviceinsight.home;
import android.app.ExpandableListActivity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.text.Html;
import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.ExpandableListView;
import android.widget.TextView;
import android.support.v4.content.ContextCompat;
import com.androidquery.AQuery;
import com.xera.deviceinsight.Globals;
import com.xera.deviceinsight.R;
import android.graphics.drawable.Drawable;
import java.util.ArrayList;
/**
* Created by timothycoutlakis on 2015/02/14.
*/
public class ExpandableListMainActivity extends ExpandableListActivity
{
// Create ArrayList to hold parent Items and Child Items
private Context context;
private ArrayList<String> parentItems = new ArrayList<String>();
private ArrayList<Object> childItems = new ArrayList<Object>();
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
// Create Expandable List and set it's properties
ExpandableListView expandableList = getExpandableListView();
expandableList.setDividerHeight(2);
expandableList.setGroupIndicator(null);
expandableList.setClickable(true);
// Set the Items of Parent
setGroupParents();
// Set The Child Data
setChildData();
// Create the Adapter
myExpandableAdaptorActivity adapter = new myExpandableAdaptorActivity(parentItems, childItems);
adapter.setInflater((LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE), this);
// Set the Adapter to expandableList
expandableList.setAdapter(adapter);
expandableList.setOnChildClickListener(this);
}
// method to add parent Items
public void setGroupParents()
{
parentItems.add("Above Grade");
parentItems.add("Acre");
parentItems.add("A/C Circuit");
parentItems.add("Accelerator");
parentItems.add("Adhesion");
parentItems.add("Adhesive Failure");
}
// method to set child data of each parent
public void setChildData()
{
// Add Child Items for Above Grade
ArrayList<String> child = new ArrayList<String>();
child.add("In plaster walls, strips of metal mesh bent at right angles and embedded in corners of ceilings and walls to prevent the plaster from cracking.");
child.add(0,String.valueOf(R.drawable.buildexpo));
context = getApplicationContext(); Drawable drawable = ContextCompat.getDrawable(context, page.getImageId());
getApplicationContext().getResources().getDrawable(2130837568);
childItems.add(child);
child = new ArrayList<String>();
child.add("In plaster walls, strips of metal mesh bent at right angles and embedded in corners of ceilings and walls to prevent the plaster from cracking.");
childItems.add(child);
child = new ArrayList<String>();
child.add("In plaster walls, strips of metal mesh bent at right angles and embedded in corners of ceilings and walls to prevent the plaster from cracking.");
childItems.add(child);
child = new ArrayList<String>();
child.add("In plaster walls, strips of metal mesh bent at right angles and embedded in corners of ceilings and walls to prevent the plaster from cracking.");
childItems.add(child);
child = new ArrayList<String>();
child.add("In plaster walls, strips of metal mesh bent at right angles and embedded in corners of ceilings and walls to prevent the plaster from cracking.");
childItems.add(child);
child = new ArrayList<String>();
child.add("In plaster walls, strips of metal mesh bent at right angles and embedded in corners of ceilings and walls to prevent the plaster from cracking.");
childItems.add(child);
}
}
答案 0 :(得分:0)
这意味着您要么没有名为page
的变量,要么在您尝试使用它的范围内无法访问它。