Обновление
Весь код с Main, фрагментом xmls и классами.
MainActivity XML
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/fragmentContainer"/>
</LinearLayout>
MainActivity Java
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class PhotoEditorActivity extends AppCompatActivity {
FragmentManager fragManager;
FragmentTransaction fragTransaction;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_photo_editor);
fragManager=getFragmentManager();
fragManager.findFragmentById(R.id.fragmentContainer);
fragTransaction=fragManager.beginTransaction();
fragTransaction.replace(R.id.fragmentContainer, new PhotoEditorFragment());
fragTransaction.commit();
}
}
Фрагмент XML
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent">
<ja.burhanrashid52.photoeditor.PhotoEditorView
android:id="@+id/photoEditorView"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</ja.burhanrashid52.photoeditor.PhotoEditorView>
</RelativeLayout>
Фрагмент Java
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
public class PhotoEditorFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater,ViewGroup container, Bundle
savedInstanceState) {
View itemView=inflater.inflate(R.layout.photo_editor_fragment,container,false);
try
{
return itemView;}
catch (Exception e){
return null;
}
}
}
Этот код отлично работает на моей андроид студии. Я не импортировал банку, но добавил зависимость в gradle
dependencies {
implementation 'ja.burhanrashid52:photoeditor:0.4.0'
}