2017-02-24 50 views
-3

如何將相對佈局分爲兩部分或三部分?有沒有適當的方法..?如何將相對佈局分成兩部分,就像在一行中想添加兩個按鈕那樣可能?

+1

我不明白, 你想要什麼。看到這個答案[這裏](http://stackoverflow.com/questions/33752578/how-to-display-gif-on-android-device?rq=1),或者試試這個[庫](https:// github .com/koral -/android-gif-drawable) – bvarga

+0

其不可理解的問題,你可以使用http://stackoverflow.com/a/34870817/1318946 –

+0

嘗試在給定的鏈接解決方案。 http://stackoverflow.com/questions/6533942/adding-gif-image-in-an-imageview-in-android –

回答

0

我剛剛使用這個代碼和它的工作 第一次添加庫

編譯 'pl.droidsonroids.gif:Android的GIF抽拉:1.2.3'

然後設置GIF佈局,你想要把GIF這樣

<pl.droidsonroids.gif.GifTextView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:background="@drawable/your_gif"/> 
2

使用這個庫

編譯 'pl.droidsonroids.gif:Android的GIF抽拉:1.2.3'

<pl.droidsonroids.gif.GifImageView 
     android:id="@+id/gif_iv" 
     android:layout_width="100dp" 
     android:layout_height="100dp" 
     android:scaleType="centerCrop" 
     android:src="@drawable/ic_ani_gif" 
     app:layout_anchor="@+id/rl_holder_view" 
     app:layout_anchorGravity="center|top" /> 
0

試試這個:

"android.resource://[package]/[res id]" 

    Uri myUri =("android.resource://" + context.getPackageName() + "/" 
         + R.drwable.mygifimage); 
    try{ 
     Url myUrl = myUri.toURL(); 
     webView wView = new webView(this); 
     wView.loadUrl(myUrl); 
     setContentView(view); 

     }catch(Exception e){ 
       e.printStackTrace() 
     } 
相關問題