最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Android仿Iphone屏幕底部彈出半透明PopupWindow效果

 更新時間:2017年07月11日 10:09:06   作者:lfdfhl  
這篇文章主要為大家詳細介紹了Android仿Iphone屏幕底部彈出半透明PopupWindow效果,具有一定的參考價值,感興趣的小伙伴們可以參考一下

本文實例為大家分享了Android仿Iphone屏幕底部彈出效果的具體代碼,供大家參考,具體內容如下

main.xml如下:

 <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  >
  <Button 
    android:id="@+id/button"
    android:text="popupWindow"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
  />
</RelativeLayout> 

styles.xml如下:

 <?xml version="1.0" encoding="utf-8"?>
<resources>
  <style name="popupAnimation" parent="android:Animation">
 <item name="android:windowEnterAnimation">@anim/in</item>
 <item name="android:windowExitAnimation">@anim/out</item>
 </style>
</resources> 

popupwindow.xml如下:
 <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:background="#b5555555" >

  <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_marginBottom="12dip"
    android:paddingLeft="10dip"
    android:paddingRight="10dip"
    android:orientation="vertical" >
    <Button
      android:id="@+id/confirmButton"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:layout_gravity="center"
      android:text="確定"/>

    <Button
      android:id="@+id/cancleButton"
      android:layout_marginTop="12dip"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:layout_gravity="center"
      android:text="取消" />
  </LinearLayout>

</RelativeLayout> 

in.xml如下:

 <?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
  <translate
    android:fromYDelta="5000"
    android:toYDelta="0"
    android:duration="1500"
  />
</set> 

out.xml如下:

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
  <translate
    android:fromYDelta="0"
    android:toYDelta="5000"
    android:duration="1500"
  />
</set> 

PopupWindowTestActivity.Java如下:

 import android.app.Activity;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.widget.Button;
import android.widget.PopupWindow;
/**
 * Demo描述:
 * 仿Iphone從屏幕底部彈出半透明的PopupWindow
 */
public class PopupWindowTestActivity extends Activity {
 private Button button;
  private Button confirmButton;
  private Button cancleButton;
  private PopupWindow popupWindow;
  private View popupWindowView;
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    init();
  }
  private void init(){
    button=(Button) findViewById(R.id.button);
    button.setOnClickListener(new ButtonOnClickListener());
  }

 private class ButtonOnClickListener implements OnClickListener {
 @Override
 public void onClick(View v) {
  switch (v.getId()) {
  case R.id.button:
  LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
  popupWindowView = inflater.inflate(R.layout.popupwindow, null);
  popupWindow = new PopupWindow(popupWindowView,LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT,true);
  popupWindow.setBackgroundDrawable(new BitmapDrawable());
  //設置PopupWindow的彈出和消失效果
  popupWindow.setAnimationStyle(R.style.popupAnimation);
  confirmButton = (Button) popupWindowView.findViewById(R.id.confirmButton);
  confirmButton.setOnClickListener(new ButtonOnClickListener());
  cancleButton = (Button) popupWindowView.findViewById(R.id.cancleButton);
  cancleButton.setOnClickListener(new ButtonOnClickListener());
  popupWindow.showAtLocation(confirmButton, Gravity.CENTER, 0, 0);
  break;
  case R.id.confirmButton:
  System.out.println("點擊了確定按鈕");
  break;
  case R.id.cancleButton:
  popupWindow.dismiss();
  break;
  default:
  break;
  }

 }}
}

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。

相關文章

  • Kotlin實現(xiàn)多函數(shù)接口的簡化調用

    Kotlin實現(xiàn)多函數(shù)接口的簡化調用

    這篇文章主要為大家詳細介紹了Kotlin實現(xiàn)多函數(shù)接口的簡化調用,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2017-06-06
  • Android Okhttp斷點續(xù)傳面試深入解析

    Android Okhttp斷點續(xù)傳面試深入解析

    這篇文章主要給大家介紹了關于Android Okhttp斷點續(xù)傳面試的相關資料,文中通過示例代碼介紹的非常詳細,對大家學習或者使用Android具有一定的參考學習價值,需要的朋友們下面來一起學習學習吧
    2019-06-06
  • Android 實現(xiàn)截屏功能的實例

    Android 實現(xiàn)截屏功能的實例

    這篇文章主要介紹了Android 實現(xiàn)截屏功能的實例的相關資料,這里實現(xiàn)截屏的實例在代碼中注釋非常清楚,希望能幫助到大家,需要的朋友可以參考下
    2017-08-08
  • Android Studio 代理配置指南(小結)

    Android Studio 代理配置指南(小結)

    這篇文章主要介紹了Android Studio 代理配置指南(小結),小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2019-01-01
  • Android獲取熱點主機ip和連接熱點手機ip的代碼

    Android獲取熱點主機ip和連接熱點手機ip的代碼

    這篇文章主要介紹了Android獲取熱點主機ip和連接熱點手機ip的相關資料,需要的朋友可以參考下
    2018-01-01
  • Android 圖片保存到相冊不顯示的解決方案(兼容Android 10及更高版本)

    Android 圖片保存到相冊不顯示的解決方案(兼容Android 10及更高版本)

    這篇文章主要介紹了Android 圖片保存到系統(tǒng)相冊不顯示的解決方案,幫助大家更好的理解和學習使用Android開發(fā),感興趣的朋友可以了解下
    2021-04-04
  • Android LinearLayout實現(xiàn)自動換行

    Android LinearLayout實現(xiàn)自動換行

    這篇文章主要為大家詳細介紹了Android LinearLayout實現(xiàn)自動換行,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2018-08-08
  • Android實現(xiàn)圓角圖片

    Android實現(xiàn)圓角圖片

    這篇文章主要為大家詳細介紹了Android實現(xiàn)圓角圖片,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2021-01-01
  • android表格效果之ListView隔行變色實現(xiàn)代碼

    android表格效果之ListView隔行變色實現(xiàn)代碼

    首先繼承SimpleAdapter再使用重載的Adapter來達到效果,其實主要是需要重載SimpleAdapter,感興趣的朋友可以研究下,希望本文可以幫助到你
    2013-02-02
  • Android解析Intent Filter的方法

    Android解析Intent Filter的方法

    這篇文章主要介紹了Android解析Intent Filter的方法,較為詳細的分析了Intent解析的原理與相關技巧,具有一定參考借鑒價值,需要的朋友可以參考下
    2015-07-07

最新評論

固原市| 信阳市| 游戏| 北辰区| 鄂尔多斯市| 丹寨县| 祁连县| 长子县| 西宁市| 汝州市| 新巴尔虎左旗| 辉县市| 偏关县| 丰顺县| 淮安市| 五指山市| 大田县| 翁源县| 迁安市| 都安| 伊川县| 武穴市| 宁蒗| 五河县| 金门县| 崇左市| 前郭尔| 巨鹿县| 灌阳县| 攀枝花市| 玉溪市| 赞皇县| 庄浪县| 南昌县| 长垣县| 武冈市| 凤台县| 通化县| 西和县| 怀集县| 扎鲁特旗|