我正在使用导航抽屉和tablayout.我的标签中有一个视频,一开始看不到,但我能听到声音.一旦我设定
video_view.setZOrderOnTop(true);
Run Code Online (Sandbox Code Playgroud)
我也可以看到视频,但这会导致导航抽屉出现问题.
当我滑动它时,视频不会像所有其他元素一样隐藏在导航抽屉后面.
如果我不使用
video_view.setZOrderOnTop(true);
Run Code Online (Sandbox Code Playgroud)
然后我的抽屉工作正常.
main_activity.xml
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- Framelayout to display Fragments -->
<android.support.design.widget.CoordinatorLayout
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.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/menuwhite2"
android:id="@+id/custom_home"
android:gravity="center"
android:layout_gravity="right"
android:layout_marginRight="10dp"/>
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabMode="fixed"
app:tabGravity="fill"
/>
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>
<!-- Listview to display slider menu -->
<ListView
android:id="@+id/list_slidermenu"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="end"
android:choiceMode="singleChoice"
android:divider="@color/list_divider"
android:dividerHeight="1dp"
android:listSelector="@drawable/list_selector"
android:background="@color/list_background"/>
Run Code Online (Sandbox Code Playgroud)
tab_fragment.xml
<?xml …Run Code Online (Sandbox Code Playgroud) android navigation-drawer android-videoview android-tablayout
我正在尝试使用NFC和Android Pay API实现"点击和支付(用于支付交易)".
我没有找到任何关于此的教程或示例.
我看了developer.android.com,但没有得到它.
以上文档讨论了使用基于主机的卡仿真与NFC进行通信 (我可能错了)
怎么能实现这一目标?是否有其他API或我是否必须将支付协议与基于主机的卡仿真服务集成?
public class MyHostApduService extends HostApduService {
@Override
public byte[] processCommandApdu(byte[] apdu, Bundle extras) {
//Implement PAYMENT protocol here
}
@Override
public void onDeactivated(int reason) {
...
}
}
Run Code Online (Sandbox Code Playgroud) 键盘打开时,屏幕顶部会出现白色条带,无论键盘状态如何变化,它都会持续存在.
如果我使用adjustPan它然后它工作,但是,我想adjustResize只使用.
<activity
android:name=".MainActivity"
android:screenOrientation="portrait"
android:theme="@style/MyTheme"
android:windowSoftInputMode="adjustResize"/>
<style name="MyTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:windowDrawsSystemBarBackgrounds"
tools:targetApi="lollipop">false</item>
</style>
Run Code Online (Sandbox Code Playgroud) 我有三个活动
MessagesAttachPhotoActivityMessageGalleryFolderSelectorActivityImagePickerActivityMessagesAttachPhotoActivity呼吁MessageGalleryFolderSelectorActivity有startActivityForResult().
MessageGalleryFolderSelectorActivity 活动显示手机上的照片文件夹,一个选择文件夹.
ImagePickerActivity然后调用setActivityForResult().一旦选择了图像ImagePickerActivity,它就会被传递回MessagesAttachPhotoActivityvia MessageGalleryFolderSelectorActivity.
当我第一次运行应用程序时,一切正常.但是,如果我之后尝试再次选择图像,MessageGalleryFolderSelectorActivity则不会在之后关闭setResult().
我已经打过电话finish(),this.finish(),((Activity)getApplicationContext()).finish(),并super.onBackPressed()没有成功.
为什么活动不会在连续运行中关闭?
Intent intent;
Bundle arguments = new Bundle();
Bundle bundle;
intent = new Intent(this, MessageGalleryFolderSelectorActivity.class);
bundle = new Bundle();
bundle.putInt(Constants.INTENT_EXTRA_LIMIT, Constants.IMAGES_SELECT_LIMIT);
bundle.putInt("Request", MessageThread.MessageType.IMAGE);
intent.putExtras(bundle);
startActivityForResult(intent, MessageThread.MessageType.IMAGE);
Run Code Online (Sandbox Code Playgroud)
imagesIntent.putExtra(ImagePickerActivity.INTENT_EXTRA_MODE,
ImagePickerActivity.MODE_MULTIPLE);
imagesIntent.putExtra(ImagePickerActivity.INTENT_EXTRA_LIMIT, 10);
imagesIntent.putExtra(ImagePickerActivity.INTENT_EXTRA_SHOW_CAMERA, false);
imagesIntent.putExtra(ImagePickerActivity.INTENT_EXTRA_ALBUM,album);
//imagesIntent.putExtra(ImagePickerActivity.INTENT_EXTRA_SELECTED_IMAGES, images);
startActivityForResult(imagesIntent, MessageThread.MessageType.IMAGE);
Run Code Online (Sandbox Code Playgroud)
Intent data = …Run Code Online (Sandbox Code Playgroud) android android-intent android-activity startactivityforresult
我正在使用volly来完美地检索数据及其工作,除了我的json数组没有存储在缓存中.
这是我的代码:
private void getCacheValue() {
Cache cache = AppController.getInstance().getRequestQueue().getCache();
Cache.Entry entry = cache.get(Endpoints.product_url);
if(entry != null){
Log.w("Logdata:", ""+ entry.toString());
try {
String data = new String(entry.data, "UTF-8");
JSONArray jsonArray = new JSONArray(data);
// handle data, like converting it to xml, json, bitmap etc.,
Log.v("Hello", data);
listProduct.clear();
for (int i = 0; i < jsonArray.length(); i++) {
try {
JSONObject object = jsonArray.getJSONObject(i);
ItemCategories image = new ItemCategories();
image.setCategoryItem(object.getString(key_title));
image.setUrlThumb(object.getString(key_image));
listProduct.add(image);
} catch (JSONException e) {
Log.e(TAG, "Json parsing error: …Run Code Online (Sandbox Code Playgroud) 我有一个MainActivity和3个碎片 -
我必须用PageCurl EffectA-> B-> C 替换片段
我如何使用PageCurl EffectFragments?
我已阅读PageCurl链接,但它们仅用于图像.