I was wondering why the image here is not loading at all. The XML file does not show the image, it does however show the TextView
and the Button
.
Please help.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="@+id/textView2"
android:layout_width="177dp"
android:layout_height="wrap_content"
android:text="Middle Right Pop Up" />
<Button
android:id="@+id/button2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button" />
<ImageView
android:id="@+id/small_circle"
android:layout_width="180dp"
android:layout_height="wrap_content"
app:srcCompat="@drawable/small_compass" />
</LinearLayout>
,
public class PopUpMiddleRight extends Activity{
ImageView compass;
private float currentDegree = 0f;
private static SensorManager sensorService;
private Sensor sensor;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pop_up_middle_right);
WindowManager.LayoutParams windowManager =
getWindow().getAttributes();
windowManager.dimAmount = 0.75f;
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
int width = dm.widthPixels;
int height = dm.heightPixels;
getWindow().setLayout((int)(width * .8), (int)(height * .6));
}
}
I am trying to make a pop up window so it would look something like this:
Also Please note that I am referencing the image in another place in my code, so it can read the image.