В отличие от приложения, который написал Google мне не нужно после этого его "тянуть" что бы нижняя панель "развернулась" на весь экран. Данная панель должна быть фиксированной высоты. Данную проблему я решил.
Но теперь мне нужно закрепить на этой панели Floating Action Button. Как показано на рисунке ниже:

activity_main.xml:
Код: Выделить всё
<RelativeLayout 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"
android:background="@android:color/holo_orange_light"
tools:context=".MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/background_dark"
android:text="@string/hello_world" />
<FrameLayout
android:id="@+id/container"
android:layout_height="100dp"
android:layout_width="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
android:translationY="100dp"
</FrameLayout>
Код: Выделить всё
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FFF">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Panel"
android:textColor="#0000DD"
android:textStyle="bold"
android:layout_centerHorizontal="true"
android:padding="5dp" />
Код: Выделить всё
public class Fragment1 extends Fragment {
public static final String TAG = "FRAGMENT1";
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment1, container, false);
}
Код: Выделить всё
public class MainActivity extends AppCompatActivity {
private Fragment1 fragment1;
private FragmentManager fragmentManager;
private FragmentTransaction fragmentTransaction;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
fragmentManager = getSupportFragmentManager();
fragment1 = new Fragment1();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
if (fragmentManager.findFragmentByTag(Fragment1.TAG) == null) {
fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.setCustomAnimations(R.anim.slide_in_bottom, R.anim.slide_out_bottom);
fragmentTransaction.add(R.id.container, fragment1, Fragment1.TAG);
fragmentTransaction.commit();
} else {
fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.setCustomAnimations(R.anim.slide_in_bottom, R.anim.slide_out_bottom);
fragmentTransaction.remove(fragment1);
fragmentTransaction.commit();
}
return true;
}
return super.onOptionsItemSelected(item);
}