Основной изюминкой моей деятельности является изображение в центре, которое можно масштабировать до всего экрана. Прямо сейчас, позиции в порядке, но в некоторой точке масштабирования на изображении два текстовых изображения покрываются изображением, остальная часть обзора остается в верхней части изображения.FrameLayout: View Arrangement and Null Pointer Exception
Так что моя главная проблема - разместить два текста в верхней части изображения. Я попытался передать позиции каждого из представлений в xml, но по какой-то причине я получил исключение нулевого указателя.
XML
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:gravity="center" >
<TextView
android:id="@+id/txtName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/textView1"
android:layout_marginTop="20dp"
android:textColor="#FF4F00"
android:textSize="20sp"
android:alpha=".5"
android:text="Name" />
<TextView
android:id="@+id/txtPid"
android:layout_below="@+id/txtName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:textColor="#FF4F00"
android:textSize="20sp"
android:layout_marginTop="20dp"
android:alpha=".5"
android:text="Category Or PID" />
<ImageView
android:id="@+id/iv_photo"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:scaleType="center" />
<TextView
android:id="@+id/txtItemNo"
android:layout_below="@+id/txtSellingPrice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginTop="19dp"
android:textColor="#FF4F00"
android:textSize="20sp"
android:alpha=".5"
android:text="Item No" />
<TextView
android:id="@+id/txtSellingPrice"
android:layout_below="@+id/txtPid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginTop="20dp"
android:textColor="#FF4F00"
android:textSize="20sp"
android:alpha=".5"
android:text="Selling Price" />
</RelativeLayout>
</FrameLayout>
вы можете показать это графически хау это выглядеть или что вы достичь? –
Я добавил снимок экрана – rahstame