Я пытаюсь надуть более одного индикатора выполнения в макете. Скажите, пожалуйста, что-то не так с макетами.У меня есть xml-код battery.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="fill_parent"
android:orientation="horizontal" android:background="#FFFFFF">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:orientation="vertical"
android:id="@+id/batteryholder">
<TextView android:text="Test ID: 137" android:gravity="left"
android:id="@+id/test_id" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:textSize="14dip"
android:paddingLeft="30dip" android:paddingTop="10dip"
android:textColor="#000000" />
<HorizontalScrollView
android:id="@+id/scroll_battery"
android:layout_width="420dip"
android:layout_height="200dip"
android:layout_marginTop="0dip" >
и другой файл batterylayout.xml:
<?xml version="1.0" encoding="UTF-8"?>
<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/empty_battery" />
<ProgressBar
android:id="@+id/vertical_progressbar"
style="@style/Widget.ProgressBar.Vertical"
android:layout_width="88dp"
android:layout_height="150dp"
android:layout_x="2dp"
android:layout_y="23dp" />
</AbsoluteLayout>
<AbsoluteLayout
android:id="@+id/scrolllinearlayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</AbsoluteLayout>
</HorizontalScrollView>
</LinearLayout>
, как я могу накачать более одной батареи в справке battery.xml.Plz.
Мой код Java:
setContentView(R.layout.battery);
batteryHolder = (LinearLayout)batteryHolder.findViewById(R.id.batteryholder);
((TextView) findViewById(R.id.test_id)).setText(Html.fromHtml("<b>Test ID:</b>"+Student_record.getString(3)));
scrollview_battery = (HorizontalScrollView)scrollview_battery.findViewById(R.id.scroll_battery);
scrolllayout_battery = (AbsoluteLayout)scrolllayout_battery.findViewById(R.id.scrolllinearlayout);
LayoutInflater inflater = getLayoutInflater();
LinearLayout battery = (LinearLayout)inflater.inflate(R.layout.batterylayout, scrolllayout_battery, false);
ProgressBar bar= (ProgressBar)findViewById(R.id.vertical_progressbar);
bar.setMax(100);
bar.setProgress(percentage[i]);
scrolllayout_battery.addView(battery);
Я получаю нулевой указатель на
batteryHolder = (LinearLayout)batteryHolder.findViewById(R.id.batteryholder)