小编K1-*_*ria的帖子

如何为viewpager片段设置标记?

我,使用带有4个选项卡的slidingTabLayout和每个选项卡的viewpager和4个片段类.

当用户点击某个按钮时,我需要在我的项目中重新加载我的一个片段(第一个标签),为此我需要为该片段添加一个标签

我的问题是:如何为其中一个viewpagers片段设置一个标签???

我的MainActivity选项卡和viewpager代码:

public class MainActivity extends AppCompatActivity
    implements NavigationView.OnNavigationItemSelectedListener {



Toolbar toolbar;
ViewPager pager;
ViewPagerAdapter adapter;
SlidingTabLayout tabs;
CharSequence Titles[]={"???","????","????","???"};
int Numboftabs = 4;




@Override
protected void attachBaseContext(Context newBase) {
    super.attachBaseContext(CalligraphyContextWrapper.wrap(newBase));
}



@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);




    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Snackbar.make(view, "??? ???? ??????", Snackbar.LENGTH_LONG)
                    .setAction("Action", null).show();
        }
    });



    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);

    NavigationView navigationView = (NavigationView) …
Run Code Online (Sandbox Code Playgroud)

android android-fragments android-viewpager

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

我如何使用Vue Async组件?

我正在使用laravel 5.4和vue 2,我想使用按钮将组件加载为异步.我的Vue js组件是独立的:example.vue和test.vue,我将它们加载为html标记.

这是我的app.js:

import './bootstrap';
import example from './components/Example.vue';

Vue.component('example', example);

const app = new Vue({
el: '#app'
});
Run Code Online (Sandbox Code Playgroud)

这是展示组件的地方

    <How can i use Async components?div id="app">
         <example2></example2> 
    </div>
Run Code Online (Sandbox Code Playgroud)

我如何使用Async组件?


不,我想你不理解我.这是我的组件注册

import './bootstrap';
import example from './components/Example.vue';

Vue.component('example', example);

Vue.component('example2', function (resolve) {

require(['./components/Example2.vue'],resolve)

})


const app = new Vue({
el: '#app'
});
Run Code Online (Sandbox Code Playgroud)

并且在require中,它默认已解析(如显示)我不知道在调用组件时如何在我的页面中传递解析并拒绝此方法的键.

vue.js async-components vuejs2

8
推荐指数
3
解决办法
1万
查看次数

如何删除android动作栏Shadow

我正在使用Android Studio进行编程.目标SDK为23,最低SDK为15

我正在尝试删除操作栏和滑动标签布局之间的阴影.但我无法做到.

注意:阴影仅在Android 5和更高版本中可见.

我已经使用<item name="elevation">0dp</item>getSupportActionBar().setElevation(0); ,但它仍然不工作...

在此输入图像描述

我的Style.xml

<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>



<style name="AppTheme.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
</style>



<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light">
    <item name="elevation">0dp</item>
</style>
Run Code Online (Sandbox Code Playgroud)

我的风格V21

<resources>>
<style name="AppTheme.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
    <item name="android:windowDrawsSystemBarBackgrounds">true</item>
    <item name="android:statusBarColor">@android:color/transparent</item>
</style>
Run Code Online (Sandbox Code Playgroud)

我的MainActivity.java onCreateCode:

 @Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar); …
Run Code Online (Sandbox Code Playgroud)

android android-actionbar

6
推荐指数
1
解决办法
4436
查看次数

android RecyclerView setOnScrollChangeListener需要api 23吗?

我正在使用volley - CardView和RecyclerView来创建一个项目,这个项目从json url提供信息并在我的应用程序中显示

但RecyclerView.setOnScrollChangeListener只需要api 23,并且不会在其他版本中运行

我该怎么办?

我的依赖:

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.android.support:cardview-v7:23.1.1'
compile files('libs/volley.jar') }
Run Code Online (Sandbox Code Playgroud)

android android-recyclerview

5
推荐指数
1
解决办法
7306
查看次数

Android Deeplink 打开应用程序两次

我使用 webview 创建应用程序并实现深度链接,如下所示:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.ariagp.myapplication">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">


        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>


            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="https" android:host="mysitename.com" />
            </intent-filter>
        </activity>
    </application>

</manifest>
Run Code Online (Sandbox Code Playgroud)

在打开链接之前,它会要求我打开我的应用程序,但问题是:两个应用程序将在手机任务管理器中打开(该应用程序不会在上一个正在运行的应用程序中打开):

在此输入图像描述

解决办法是什么?

java android deep-linking webview android-studio

4
推荐指数
1
解决办法
4767
查看次数

如何在laravel路由中定义两个参数

即时通讯使用laravel 5.4,我有一个品牌和一个产品表.我想在路由中定义两个参数,并在控制器或RouteServiceProvider中进行搜索.

想象一下:site.com/samsung/ =>以三星品牌获得所有产品.

并且:site.com/samsung/galaxys8 =>获得所有采用三星品牌和galaxys8型号的产品

我可以使用两个独立的路径和控制器方法来定义它:(使用1个参数{brand}和controller @ method1定义路由1,并使用2个参数{brand}/{product}和controller @ method2定义路由2)

我能做得更好吗?我在laravel有点新.谢谢

Route::get('/{brand}', 'AdvertismentController@show');
Route::get('/{brand}/{product}', 'AdvertismentController@show2');



public function show($brand)
{
        $brands = Advertisment::where('brand' , $brand)->get();
        return $brands;
}

public function show2($brand , $product)
{
    $products = Advertisment::where('product' , $product)->get();
    return $products;
}
Run Code Online (Sandbox Code Playgroud)

php routes laravel laravel-5 laravel-5.3

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

laravel如何验证等于变量

在laravel验证(注册)中,我想将一个字段与一个php变量进行比较(应该与之相等)

我怎样才能做到这一点?

protected function validator(array $data)
{

    return Validator::make($data, [
        'name' => 'required|max:255',
        'phone' => 'required|min:10|max:11|unique:users',
        'email' => 'required|email|max:255',
        'password' => 'required',
        'password_confirmation' => 'required',
        'user_captcha' => 'required'
    ]);
}
Run Code Online (Sandbox Code Playgroud)

validation laravel laravel-5 laravel-validation laravel-5.4

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