小编S.M*_*ian的帖子

FrameLayout无法强制转换为android.widget.AbsListView

我想设置一个页脚列表视图.但我得到以下错误:

 >     : FATAL EXCEPTION: main
 >     08-19 07:26:53.225: E/AndroidRuntime(1176): java.lang.ClassCastException: android.widget.FrameLayout$LayoutParams
 > cannot be cast to android.widget.AbsListView$LayoutParams
 >     08-19 07:26:53.225: E/AndroidRuntime(1176):  at android.widget.ListView.clearRecycledState(ListView.java:513)
 >     08-19 07:26:53.225: E/AndroidRuntime(1176):  at android.widget.ListView.resetList(ListView.java:500)
 >     08-19 07:26:53.225: E/AndroidRuntime(1176):  at android.widget.ListView.setAdapter(ListView.java:442)
 >     08-19 07:26:53.225: E/AndroidRuntime(1176):  at .SimpeSearch.onClick(SimpeSearch.java:91)
Run Code Online (Sandbox Code Playgroud)

第91行是setAdapter方法:

FrameLayout footerLayout = (FrameLayout) getLayoutInflater().inflate(R.layout.footer_loadmore,null);
TextView footer = (TextView) footerLayout.findViewById(R.id.footer);



listview.addFooterView(footer);

        AdapterSimpleSearch ad = new AdapterSimpleSearch(this,R.layout.row_list_simple_search,10, footer);
listview.setAdapter(ad); 
Run Code Online (Sandbox Code Playgroud)

footer_loadmore:

<?xml version="1.0" encoding="utf-8"?>

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="6dp"
>

<TextView android:id="@+id/footer"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:textAppearance="@android:style/TextAppearance.Medium"
    android:text="Loading..."
    />

</FrameLayout> …
Run Code Online (Sandbox Code Playgroud)

xml android android-listview

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

使用自定义样式的crouton库

我正在使用Crouton lib(https://github.com/keyboardsurfer/Crouton).

现在,我想使用自定义样式而不是默认样式.我能怎么做 ?

Style.ALERT是默认样式.

Crouton.showText(this, "test", Style.ALERT);
Run Code Online (Sandbox Code Playgroud)

我想用这种风格:

@styles:

<style name="CroutonGreen">
    <item name="android:layout_width">match_parent</item>
    <item name="android:layout_height">wrap_content</item>
    <item name="android:background">@color/color_pressed_buy_an_item</item>
    <item name="android:gravity">center</item>

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

android crouton

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

错误:找不到:com.nineoldandroids:library:2.4.0

我要迁移到android studio。

我想使用这个库:

https://codeload.github.com/flavienlaurent/datetimepicker/zip/master

在本教程之后:

https://www.youtube.com/watch?v=1MyBO9z7ojk

现在我得到这个错误:

错误:找不到:com.nineoldandroids:library:2.4.0


datetimepicker-library中的 build.gradle :

apply plugin: 'com.android.library'

repositories {
    mavenCentral()
}

dependencies {
    compile 'com.nineoldandroids:library:2.4.0'
    compile 'com.android.support:support-v4:20.0.0'
}

android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    buildToolsVersion rootProject.ext.buildToolsVersion

    defaultConfig {
        minSdkVersion 11
        targetSdkVersion 19
        versionName rootProject.versionName
        versionCode rootProject.versionCode
    }

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }
    }
}

//apply from: 'https://raw.github.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle'
Run Code Online (Sandbox Code Playgroud)

更新

在此处输入图片说明

我所有的错误:

android android-studio

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

类别和子类别表结构 - mysql

管理员可以创建多类别和子类别。

例如管理员可以:

cat1                            cat2
   ->sub1                         ->sub1
   ->sub2                            ->sub1_1
   ->sub3
      ->sub3_1
      ->sub3_2
         ->sub3_2_1
         ->sub3_2_2
   ->sub4
      sub4_1
   -sub5
Run Code Online (Sandbox Code Playgroud)

我不知道什么是最好的选择?我应该一张桌子还是两张桌子?

这是我所知道的:

id    title   parent_cat_id

1      cat1        0
2      sub1        1
3      sub2        1
3      sub3        1
4      sub3_1      3
5      sub3_2      3
6      sub3_2_1 5
7      sub3_2_2 5
...  
Run Code Online (Sandbox Code Playgroud)

php mysql

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

RelationNotFoundException.php 中的 RelationNotFoundException

每个产品hasMany属性。

当我使用with函数时:

dd(Product::with(ProductProperty::class)->get());
Run Code Online (Sandbox Code Playgroud)

我收到此错误:

RelationNotFoundException in RelationNotFoundException.php 
Call to undefined relationship [App\Models\ProductProperty] on model [App\Models\Product].
Run Code Online (Sandbox Code Playgroud)
class Product extends Model
{
    protected $table = 'products';


    protected $fillable = [
        'user_id' ,'brand_id' , 'title', 'price', 'current_buy','max_buy','min_buy_per_bill',
        'max_buy_per_bill','count','off','seri','short_description','long_description',
    ];



    public function ProductProperty()
    {
        return $this->hasMany('App\Models\ProductProperty');
    }
}
Run Code Online (Sandbox Code Playgroud)
class ProductProperty extends Model
{
    protected $table = 'products_properties';

    protected $fillable = [
        'product_id' ,'parent_id' , 'title','value', 'price', 'current_buy','max_buy','min_buy_per_bill',
        'max_buy_per_bill','count','off','seri','short_description','long_description',
    ];

    public function Product()
    {
        return $this->belongsTo('App\Models\Product');
    }
}
Run Code Online (Sandbox Code Playgroud)

laravel laravel-5

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

滚动视图不垂直滚动

我有一个滚动视图,它根本不滚动:

在此输入图像描述


在此输入图像描述

在此输入图像描述

    scroll_view_content_a_job.contentSize.height = 1800
    scroll_view_content_a_job.isScrollEnabled = true
Run Code Online (Sandbox Code Playgroud)

xcode uiscrollview ios autolayout

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

如何获得视频的持续时间 - laravel

我想在上传视频时获取视频的时长。为此,我像这样上传我的视频:

$video = Carbon::now()->timestamp . '_' .
            $request->file('video')->getClientOriginalName();


        $request->file('video')->move(
            $this->getCorrectPathOnServerAndLocal('/assets/videos/videos'), $video
        );
Run Code Online (Sandbox Code Playgroud)

我的电影上传得很好。现在我想知道这个视频的持续时间。我正在使用PHP-FFMpeg

composer require php-ffmpeg/php-ffmpeg
Run Code Online (Sandbox Code Playgroud)
$ffprobe = FFProbe::create(); //error
        dd("test");
        $duration = $ffprobe
            ->format($this->getCorrectPathOnServerAndLocal('/assets/videos/videos').$video) // extracts file informations
            ->get('duration');
Run Code Online (Sandbox Code Playgroud)

但我收到了这个错误:

  (2/2) ExecutableNotFoundException

Unable to load FFProbe
in FFProbeDriver.php (line 50)
at FFProbeDriver::create(array(), null)in FFProbe.php (line 207)
Run Code Online (Sandbox Code Playgroud)

ffmpeg laravel laravel-5

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

如何在屏幕上设置按钮居中 - 原生基础

我正在使用本机基础库的按钮。

这是我的全部代码:

  <LinearGradient
      start={{x: 0.0, y: 0.1}} end={{x: 0.5, y: 1.0}}
      locations={[0.2,0.23,0.9]}
      colors={[randomColor1,randomColor1, randomColor2]}
      style={{flex:1,height:'100%',width:'100%',flexDirection: 'column'}}>

      <View style={{width:'100%',height:'100%',flexDirection:'column',flex:1}}>
        <View style={{flexDirection:'column',alignItems:'center',justifyContent:'center'}}>
          <Text style={{fontSize:22,marginTop:20,color:'#fff',fontWeight:'bold',textAlign:'center'}}>Powerful Composition</Text>
          <Button style={{textAlign:'center',justifyContent: 'center',alignItems: 'center',paddingLeft:40,paddingRight:40,marginTop:10,height:40}} light><Text style={{textAlign:'center'}}> JOIN </Text></Button>
        </View>

        <Text style={{fontSize:18,marginTop:20,color:'#fff',fontWeight:'bold',textAlign:'center',position:'absolute',left:0,bottom:0,marginLeft:6,marginBottom:6}}>607.8 K Votes</Text>

        <Text style={{fontSize:18,marginTop:20,color:'#fff',fontWeight:'bold',textAlign:'center',position:'absolute',right:0,bottom:0,marginLeft:6,marginBottom:6,marginRight:4}}>9 Days Left</Text>

      </View>


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

Text是屏幕的中心。但Button它下面的那个在左边的屏幕上!

我哪里错了?

javascript react-native native-base

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

TripleDES 在 javascript 中加密和解密 - CryptoJS

我正在使用 CryptoJS 库来TripleDES运行,但解密数据不起作用。我解密的数据不返回原始字符串。

var t = "a";
var d = "john";
var key = CryptoJS.MD5(t).toString()
var param = CryptoJS.TripleDES.encrypt(d, key).toString();
console.log('decrypt',CryptoJS.TripleDES.decrypt(param, key).toString())
console.log('encrypt',param) // it should return `john`. but it returns a different value.
Run Code Online (Sandbox Code Playgroud)

加密的结果:

decrypt 6a6f686e
encrypt U2FsdGVkX19Ww0uMTSo+qAV5PVzsEhSR
Run Code Online (Sandbox Code Playgroud)

https://github.com/brix/crypto-js

javascript encryption cryptojs react-native

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

如何将自定义类添加到某些路由的 body 元素 - nexjts

我想将我的自定义类添加到某些页面。例如

所有页面都必须是此类,fixed-header此路由例外:

/cart/step-1 

/login
Run Code Online (Sandbox Code Playgroud)

此类添加或删除到 body 元素。

<body className="bg-gray fixed-header" 
Run Code Online (Sandbox Code Playgroud)

但我不知道如何处理这种情况?

javascript next.js

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