小编Md *_*ury的帖子

如何在android中的linearlayout周围显示阴影?

如何为线性布局显示阴影.我想要白色圆形背景和线性布局周围的阴影.到目前为止我已经这样做了.请帮我.提前致谢.

<LinearLayout
 android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="@xml/rounded_rect_shape"
android:orientation="vertical"
android:padding="10dp">
<-- My buttons, textviews, Imageviews go here -->
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

和xml目录下的rounded_rect_shape.xml

 <?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
   android:shape="rectangle" >

   <solid android:color="#ffffff" />

   <corners
      android:bottomLeftRadius="3dp"
      android:bottomRightRadius="3dp"
      android:topLeftRadius="3dp"
      android:topRightRadius="3dp" />
</shape>
Run Code Online (Sandbox Code Playgroud)

android roundedcorners-dropshadow android-linearlayout

75
推荐指数
7
解决办法
16万
查看次数

垂直 Android TabLayout 不垂直滚动

我尝试像这张图片一样开发左 TabLayout。

在此处输入图片说明

但问题是TabLayout元素没有显示和垂直滚动。下面是我的代码,也许我错过了一些东西:

<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.v4.view.ViewPager
        android:id="@+id/viewpager"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_toRightOf="@+id/appBarLay"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
    <android.support.design.widget.AppBarLayout
        android:id="@+id/appBarLay"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_alignParentLeft="true"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
        <android.support.design.widget.TabLayout
            android:id="@+id/tabs"
            android:layout_width="60dp"
            android:layout_height="match_parent"
            app:tabBackground="@drawable/tab_color_selector"
            app:tabGravity="fill"
            app:tabMode="scrollable" />
    </android.support.design.widget.AppBarLayout>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

tabs android scroll slider

8
推荐指数
2
解决办法
9071
查看次数

在VideoView中播放来自网址的视频[Android]

我发现了类似的问题,但对我来说没什么用.我尝试从这个网址播放视频:

http://videocdn.bodybuilding.com/video/mp4/62000/62792m.mp4
Run Code Online (Sandbox Code Playgroud)

我的java代码:

VideoView videoView= (VideoView)findViewById(R.id.exerciseVideo);
    Uri uri = Uri.parse(TEST_URL);
    videoView.setVideoURI(uri);
    videoView.requestFocus();
    videoView.start();
Run Code Online (Sandbox Code Playgroud)

当我运行app时,活动中不显示任何内容,IDE不会显示任何错误.请问好吗?

编辑:

我想要播放视频的活动:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <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"
        android:paddingBottom="@dimen/activity_vertical_margin"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin"
        tools:context="com.example.martin.fitnessapp.ExerciseDetailActivity"
        android:orientation="vertical">


        <LinearLayout
            android:orientation="horizontal"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:weightSum="2">
            <ImageView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/exerciseImgA"
                android:layout_weight="1"
                android:scaleType="fitCenter"
                android:adjustViewBounds="true"
                android:paddingRight="8dp"/>

            <ImageView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:id="@+id/exerciseImgB"
                android:layout_weight="1"
                android:scaleType="fitCenter"
                android:adjustViewBounds="true"
                android:paddingLeft="8dp"/>
        </LinearLayout>

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:text=""
            android:id="@+id/exerciseDesc" />

        <VideoView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/exerciseVideo" />

        <ImageView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:id="@+id/guideImg"
            android:scaleType="fitCenter"
            android:adjustViewBounds="true"/>


    </LinearLayout>
</ScrollView>
Run Code Online (Sandbox Code Playgroud)

java android android-videoview

6
推荐指数
2
解决办法
3万
查看次数

使用可选的+88或01前面的11位数来验证孟加拉国的电话号码

我使用以下正则表达式来验证印度的电话号码.

我想在11位数的手机之前选择+88或01.

这是我正在使用的:

string mobileNumber = "+8801000000000";
if (new Regex(@"^([01]|\+88)?\d{11}").IsMatch(mobileNumber)){
    MessageBox.Show("Mobile number is valide", "All information is required", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
else{
     MessageBox.Show("Mobile number is not valide", "All information is required", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
Run Code Online (Sandbox Code Playgroud)

我该怎么做?

UPDATE

如果我写手机没有.在此之前01,超过11位数字通知验证mgs(Not valid mobile no.!).好吧,我使用过,当13位数时失败.它错误地改变了验证.

这是我的代码:

<input type="text" placeholder="Enter bKash wallet number" 
  class="form-control" ng-model="BkashWalletNo" ng-disabled="AutoConfirmed" 
    name="BkashWalletNo" ng-pattern="/^(?:\+88|01)?\d{11}\r?$/" />
<p class="help-block" ng-show="form.BkashWalletNo.$error.pattern">Not valid mobile no.!</p>
Run Code Online (Sandbox Code Playgroud)

c# regex mobile angularjs

4
推荐指数
3
解决办法
5295
查看次数

adDidDismissFullScreenContent() 在版本 8 上从未被调用

我正在使用GADRewardedAd,我的要求是广告关闭后显示视图。在 API 版本 8 上,adDidPresentFullScreenContent() 会调用更新,但不会调用adDidDismissFullScreenContent()方法。

private var rewardedAdView: GADRewardedAd!
GADRewardedAd.load(withAdUnitID: UserDefaults.standard.string(forKey: Constants.ADMOB_KEY_AD_REWARDED) ?? "",
                            request: GADRequest(), completionHandler: { (ad, error) in
                              if let error = error {
                                print("Rewarded ad failed to load with error: \(error.localizedDescription)")
                                return
                              }
                              self.rewardedAdView = ad
                              self.rewardedAdView.fullScreenContentDelegate = self
                            }
Run Code Online (Sandbox Code Playgroud)
private func showRewardedAds(){
        self.isAdEarnComplete = false
        if let ad = rewardedAdView {
              ad.present(fromRootViewController: self,
                       userDidEarnRewardHandler: {
                               showToast(viewContoler: self, message: "Your coupon is ready!")
                       }
              )
    }

Run Code Online (Sandbox Code Playgroud)
extension HomeViewController: GADFullScreenContentDelegate{
    func adDidPresentFullScreenContent(_ …
Run Code Online (Sandbox Code Playgroud)

admob ios swift

1
推荐指数
2
解决办法
1990
查看次数