我有底页,我想改变它的行为,所以它会像在谷歌地图应用程序的主屏幕上一样工作,你可以将它扩展到任何位置,并留在那里,它不会自动粘在底部或顶端.这是我的底部布局:
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.gms.maps.MapView
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<View
android:id="@+id/shadow"
android:layout_width="match_parent"
android:layout_height="16dp"
android:background="@drawable/shape_gradient_top_shadow"
app:layout_anchor="@+id/map_bottom_sheet" />
<LinearLayout
android:id="@+id/map_bottom_sheet"
android:layout_width="match_parent"
android:layout_height="300dp"
android:fillViewport="false"
android:orientation="vertical"
app:behavior_peekHeight="50dp"
android:background="@color/lightGray"
app:layout_behavior="android.support.design.widget.BottomSheetBehavior">
<include layout="@layout/bottom_sheet_top_buttons"/>
<android.support.v4.widget.NestedScrollView
android:id="@+id/bottom_sheet_content_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/lightGray"/>
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)
我本质上需要的是在拖动结束时消除强制STATE_EXPANDED和STATE_COLLAPSED状态.
这是我尝试实现的目标的直观解释:

如您所见,底部纸张不会自动锚定到顶部或底部,而是保持在它留下的任何位置.
我是Symfony2的新手,我遇到了一些简单的问题,但我不确定如何应对它.我需要使用一个简单的第三方类,我不知道在项目结构中将它存储在何处以及如何存储.我应该存储我的Bundle中的服务还是我应该将它存储在供应商目录中?如果我将它存储在供应商中,那么存储不是Symfony支持的供应商的库并不是一个坏习惯吗?
在我的应用程序中,我有一个使用RecyclerView实现的项目列表.在某些情况下,项目可能会移动到列表的最后,我需要将其设置为动画.所以首先我将项目移动到数据源的末尾(在我的例子中是ArrayList)并调用适配器的notifyItemMoved(oldPosition, dataSet.size() - 1)方法.一切正常,除了我移动到最后的元素(如果它是列表的最末端或只是位置较低的位置实际上并不重要)是列表中的顶部或者第一部分可见.在这种情况下,不仅移动的项目是动画的,而且整个列表都向下滚动.
我认为这可能是我的代码中的某种混乱所以我用RecyclerView组件创建了一个干净的测试应用程序,结果是一样的.
我认为这是一个错误,RecyclerView因为它仍然是非常绿色的组件,Goggle继续开发它,虽然我很确定我不是唯一一个遇到这种问题的人,所以我希望有人有一个解决方法.
这里是我的代码片段Activity,RecyclerView.Adapter以及布局.
活动
public class RecyclerViewActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_recycler_view);
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
recyclerView.setHasFixedSize(true);
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this);
recyclerView.setLayoutManager(layoutManager);
RecyclerView.Adapter adapter = new RecyclerViewAdapter(recyclerView);
recyclerView.setAdapter(adapter);
recyclerView.addItemDecoration(new SimpleDividerItemDecoration(RecyclerViewActivity.this));
}
}
Run Code Online (Sandbox Code Playgroud)
适配器
public class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewAdapter.ViewHolder> {
private ArrayList<String> mDataSet;
private RecyclerView mRecyclerView;
public RecyclerViewAdapter(RecyclerView recyclerView) {
mRecyclerView = recyclerView;
mDataSet = new ArrayList<String>();
mDataSet.add("San Francisco"); …Run Code Online (Sandbox Code Playgroud)