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

Android開(kāi)發(fā)實(shí)現(xiàn)模仿微信小窗口功能【Dialog對(duì)話框風(fēng)格窗口】

 更新時(shí)間:2019年03月16日 09:10:08   作者:水中魚(yú)之1999  
這篇文章主要介紹了Android開(kāi)發(fā)實(shí)現(xiàn)模仿微信小窗口功能,結(jié)合實(shí)例形式分析了Android實(shí)現(xiàn)微信風(fēng)格Dialog對(duì)話框窗口相關(guān)功能與布局操作技巧,需要的朋友可以參考下

本文實(shí)例講述了Android開(kāi)發(fā)實(shí)現(xiàn)模仿微信小窗口功能。分享給大家供大家參考,具體如下:

運(yùn)用方法:

將顯示窗口的風(fēng)格 設(shè)置為對(duì)話框風(fēng)格即可

具體效果:

具體實(shí)現(xiàn):

首先我們先定義布局文件:

<?xml version="1.0" encoding="utf-8" ?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/idtatabHost"
  android:layout_width="300dp"
  android:layout_height="500dp"
  android:layout_gravity="center"
  android:layout_weight="1">
  <ImageView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:src="@drawable/wechat"
    android:scaleType="fitXY"/>
  <TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="假的 WeChat"
    android:textSize="20dp"
    android:textColor="#ffffffff"/>
  <Button
    android:id="@+id/send"
    android:onClick="send"
    android:text="點(diǎn)我一下 有驚喜(嚇) 。。。"
    android:textColor="#ffffffff"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"/>
</RelativeLayout>

然后我再活動(dòng)中照常設(shè)置監(jiān)聽(tīng)事件等方法:

public class MainActivity extends Activity {
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
  }
  public void send(View source){
    finish();
  }
}

最重要的部分:

在未見(jiàn)的 mainfest.xml 中設(shè)置 活的的樣式為對(duì)話框風(fēng)格

具體如下:

  <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"
      android:label="@string/app_name"
      android:theme="@android:style/Theme.Material.Dialog"
      tools:targetApi="lollipop">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
    </activity>
  </application>

大功告成!

更多關(guān)于Android相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《Android開(kāi)發(fā)入門與進(jìn)階教程》、《Android調(diào)試技巧與常見(jiàn)問(wèn)題解決方法匯總》、《Android基本組件用法總結(jié)》、《Android視圖View技巧總結(jié)》、《Android布局layout技巧總結(jié)》及《Android控件用法總結(jié)

希望本文所述對(duì)大家Android程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論

嘉定区| 化隆| 清流县| 上蔡县| 榆社县| 宁明县| 天全县| 金沙县| 宁陵县| 齐齐哈尔市| 永康市| 饶阳县| 巴林右旗| 额济纳旗| 龙陵县| 淮南市| 比如县| 松原市| 贵州省| 鸡泽县| 沭阳县| 兴安县| 财经| 靖安县| 阳东县| 咸阳市| 镇赉县| 江源县| 子洲县| 乐亭县| 夏津县| 沾化县| 成安县| 普宁市| 黑山县| 桂东县| 武川县| 长宁区| 自贡市| 鹤庆县| 平武县|