我有在Android上捕获视频剪辑的代码:
Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
intent.putExtra("android.intent.extra.durationLimit", 30000);
intent.putExtra("EXTRA_VIDEO_QUALITY", 0);
startActivityForResult(intent, ActivityRequests.REQUEST_TAKE_VIDEO);
Run Code Online (Sandbox Code Playgroud)
此代码适用于API 2.2,但持续时间限制不适用于API 2.1(Galaxy S).设定这个时间是否有一些常数或参数,或者是否有比我正在使用的方法更好的方法?
我问,因为我找到了另一个适用于Galaxy S(被叫Vibrant)的应用程序,可以在很短的时间内录制视频.
我的应用程序具有在服务器上发送一些内容的功能,并且(需要)在Facebook上发布它.它使用服务发送(对于商店数据我使用sqlite).是否有可能从服务处理Facebook会话等?我需要它,因为内容将存储在数据库中的时间和发送时间可能不同(可能连接将在很长时间内丢失并且在连接可用后开始发送,但只有我的应用程序的发送服务才会在此活动时间).对于这种情况我找不到任何解决方案(好的解决方案会很棒).请帮忙.
我试图在底部创建具有CoordinatorLayout和LinearLayout的RelativeLayout,并发现一些我无法解决的奇怪行为.这是我的布局
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.CoordinatorLayout
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/sender"
android:background="@android:color/white"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?actionBarSize"
android:background="?colorPrimary"
app:layout_scrollFlags="scroll|enterAlways" />
</android.support.design.widget.AppBarLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/messages_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>
<LinearLayout
android:id="@+id/sender"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:gravity="center_vertical"
android:background="@android:color/white">
<EditText
android:id="@+id/inputText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:inputType="text" />
<Button
android:fontFamily="sans-serif"
style="?android:attr/borderlessButtonStyle"
android:textAppearance="?android:textAppearanceButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/send"
android:textColor="?colorPrimary"
android:id="@+id/send"/>
</LinearLayout>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
更改适配器中的数据后,我尝试滚动到最后一个元素(例如通过recyclerView.smoothScrollToPosition(size);),我看到的只是最后一个视图的一部分(不是完整大小).如果recycleview没有嵌套到CoordinatorLayout - 一切都按预期工作 - 我看到完整大小的最后一个元素视图.如何更改布局才能正常工作?
android android-layout android-recyclerview android-coordinatorlayout