欧美一级特黄大片做受成人-亚洲成人一区二区电影-激情熟女一区二区三区-日韩专区欧美专区国产专区

Android仿微信下拉列表實現(xiàn)

         本文要實現(xiàn)微信6.1中點擊頂部菜單欄的“+”號按鈕時,會彈出一個列表框。這里用的了Activity實現(xiàn),其實最好的方法可以用ActionBar,不過這貨好像只支持3.0以后的版本。本文的接上文Android仿微信底部菜單欄+頂部菜單欄(附源碼)

“只有客戶發(fā)展了,才有我們的生存與發(fā)展!”這是成都創(chuàng)新互聯(lián)的服務宗旨!把網(wǎng)站當作互聯(lián)網(wǎng)產(chǎn)品,產(chǎn)品思維更注重全局思維、需求分析和迭代思維,在網(wǎng)站建設中就是為了建設一個不僅審美在線,而且實用性極高的網(wǎng)站。創(chuàng)新互聯(lián)對成都網(wǎng)站建設、成都網(wǎng)站制作、網(wǎng)站制作、網(wǎng)站開發(fā)、網(wǎng)頁設計、網(wǎng)站優(yōu)化、網(wǎng)絡推廣、探索永無止境。

效果:

 Android仿微信下拉列表實現(xiàn)

一、仿微信下拉列表布局pop_dialog.xml

<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" >
 
    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_marginTop="45dp"
        android:layout_marginRight="20dp">

        <LinearLayout
            android:id="@+id/id_pop_dialog_layout"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_alignParentTop="true"
            android:background="@drawable/pop_item_normal"
            android:orientation="vertical" >

            <LinearLayout
                android:id="@+id/id_groupchat"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="5dp"
                android:layout_marginRight="5dp"
                android:layout_marginTop="5dp"
                android:background="@drawable/pop_list_selector" >

                <ImageView
                    android:id="@+id/id_p_w_picpathView1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_vertical"
                    android:layout_marginLeft="8dp"
                    android:src="@drawable/pop_group" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:padding="8dp"
                    android:text="發(fā)起聊天"
                     android:layout_gravity="center_vertical"
                    android:textColor="#fff"
                    android:textSize="16sp" />
            </LinearLayout>

            <ImageView
                android:id="@+id/id_p_w_picpathView5"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/pop_line" />

            <LinearLayout
                android:id="@+id/id_addfrd"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="5dp"
                android:layout_marginRight="5dp"
                android:background="@drawable/pop_list_selector" >

                <ImageView
                    android:id="@+id/id_p_w_picpathView2"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_vertical"
                    android:layout_marginLeft="8dp"
                    android:src="@drawable/pop_add" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:padding="8dp"
                    android:text="添加朋友"
                      android:layout_gravity="center_vertical"
                    android:textColor="#fff"
                    android:textSize="16sp" />
            </LinearLayout>

            <ImageView
                android:id="@+id/id_p_w_picpathView5"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/pop_line" />

            <LinearLayout
                android:id="@+id/id_find"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="5dp"
                android:layout_marginRight="5dp"
                android:background="@drawable/pop_list_selector" >

                <ImageView
                    android:id="@+id/id_p_w_picpathView3"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_vertical"
                    android:layout_marginLeft="8dp"
                    android:src="@drawable/pop_qrcode" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:padding="8dp"
                    android:text="掃一掃"
                  android:layout_gravity="center_vertical"
                    android:textColor="#fff"
                    android:textSize="16sp" />
            </LinearLayout>

            <ImageView
                android:id="@+id/id_p_w_picpathView5"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/pop_line" />

            <LinearLayout
                android:id="@+id/id_feedback"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="3dp"
                android:layout_marginLeft="5dp"
                android:layout_marginRight="5dp"
                android:background="@drawable/pop_list_selector" >

                <ImageView
                    android:id="@+id/id_p_w_picpathView4"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_vertical"
                    android:layout_marginLeft="8dp"
                    android:src="@drawable/pop_feedback" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:padding="8dp"
                    android:text="幫助與反饋"
                   android:layout_gravity="center_vertical"
                    android:textColor="#fff"
                    android:textSize="16sp" />
            </LinearLayout>
        </LinearLayout>
    </RelativeLayout>

</RelativeLayout>


其中,按下圖片后變換顏色:

pop_list_selector.xml如下

pop_list_selector.xml如下

<?xml version="1.0" encoding="UTF-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:drawable="@drawable/pop_item_pressed" android:state_focused="true"/>
    <item android:drawable="@drawable/pop_item_pressed" android:state_pressed="true"/>
    <item android:drawable="@drawable/pop_item_pressed" android:state_selected="true"/>
    <item android:drawable="@drawable/pop_item_normal"/>

</selector>

看看效果,這是去掉標題欄后的(也可以用代碼去掉)

 Android仿微信下拉列表實現(xiàn)

去掉標題欄的方法:

 Android仿微信下拉列表實現(xiàn)

二、對應代碼

pop_dialog.xml對應的代碼為PopDialogActivity.java

如下:

/**
 * @作者 林炳文(郵箱:ling20081005@126.com)
 * @博客 http://blog.csdn.net/evankaka/
 * @功能描述:彈出微信下拉列表框
 */
package com.example.tabexample;
import android.app.Activity;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
import android.view.View.OnClickListener;
import android.widget.LinearLayout;

public class PopDialogActivity extends Activity implements OnClickListener{
	//定義四個按鈕區(qū)域
	private LinearLayout mGroupChat;
	private LinearLayout mAddFrd;
	private LinearLayout mFind;
	private LinearLayout mFeedBack;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.pop_dialog);

		initView();
	}

	/**
	 * 初始化組件
	 */
	private void initView(){
		//得到布局組件對象并設置監(jiān)聽事件
		mGroupChat = (LinearLayout)findViewById(R.id.id_groupchat);
		mAddFrd = (LinearLayout)findViewById(R.id.id_addfrd);
		mFind = (LinearLayout)findViewById(R.id.id_find);
		mFeedBack = (LinearLayout)findViewById(R.id.id_feedback);

		mGroupChat.setOnClickListener(this);
		mAddFrd.setOnClickListener(this);
		mFind.setOnClickListener(this);
		mFeedBack.setOnClickListener(this);
	}
	
	@Override
	public boolean onTouchEvent(MotionEvent event){
		finish();
		return true;
	}
	
	@Override
	public void onClick(View v) {
		
	}
}

三、設置背景透明

     如果單這樣,當這個Activity出來后,就會把之前的Activity覆蓋,但是如果把它背景設置成透明的不就可以了么?方法如下:

在AndroidManifest.xml中添加:

          <!-- 這里一定要注冊上這個activity,否則跳轉將會失敗,因為系統(tǒng)找不到這個activity -->
        <activity
            android:name="com.example.tabexample.PopDialogActivity"
            android:label="@string/app_name" 
            android:theme="@style/MyDialogStyleTop">
        </activity>

其中

"@style/MyDialogStyleTop"

是我自己定義的格式,在value/style下添加:

    <style name="MyDialogStyleTop" parent="android:Theme.Dialog">
        <item name="android:windowFrame">@null</item><!-- 邊框 -->
        <item name="android:windowIsFloating">true</item> <!-- 是否浮現(xiàn)在activity之上 -->
        <item name="android:windowIsTranslucent">false</item><!-- 半透明 -->
        <item name="android:windowNoTitle">true</item> <!-- 無標題 -->
        <item name="android:windowBackground">@android:color/transparent</item><!-- 背景透明 -->
        <item name="android:backgroundDimEnabled">false</item><!-- 模糊 -->
    </style>

四、使用

其實使用就是Activity的跳轉了,方法很簡單,一句:

startActivity(new Intent(MainActivity.this,PopDialogActivity.class));

把這句放在“+”按鈕的點擊事件當中去,這里添加點擊事件就不用說了,很簡單,然后最終的效果如下:

 Android仿微信下拉列表實現(xiàn)

若你覺得此文對你有用,那就幫我贊一下~~謝謝啦

分享題目:Android仿微信下拉列表實現(xiàn)
文章路徑:http://aaarwkj.com/article14/ggpgde.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供手機網(wǎng)站建設、云服務器品牌網(wǎng)站建設、自適應網(wǎng)站面包屑導航、網(wǎng)站營銷

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉載內(nèi)容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)

搜索引擎優(yōu)化
亚洲国产中日韩精品综合| 免费黄色福利网址大片| 国产精品色呦呦一区二区| 在线播放国产91精品| 日本一区二区三区三州免费观看| 日本欧美三级一二三区| 熟女人妻精品一二三四| 国产精品一久久香蕉产线看 | 日韩成年人高清精品不卡一区二区| 日韩三级av在线免费观看| 日本姜女黄视频免费看| 韩国福利短片在线观看| 国产l精品国产亚洲区久久| 日韩不卡在线免费观看视频| 国产区青青操自拍视频| 成人影院视频在线播放| 中文字幕乱码亚洲精品一区| 日韩不卡的一区免费视频| 国语自产拍在线观看不卡| 日本少妇入口一区二区| 欧美亚洲另类在线日韩国产 | 欧美日韩黄色的三级视频| 91超碰在线观看中文| 免费观看毛片一区二区三区| 夜夜操狠狠操天天摸| 人妻激情偷乱视91九色| 亚洲国产成人久久综合区| 欧美高清在线观看一区二区| 国产毛片一区二区在线| 欧美日韩精品人妻一区| 久久伊人69日韩精品| 麻豆一精品传二传媒短视频| 亚洲精品成人在线国产| 国语自产精品视频在线不卡| 说中文字幕的黄色大网站| 日本熟妇一区二区三区高清视频| 亚洲专区综合红桃av| 久视频这里只有精品99| 午夜精品久久99蜜桃| 日韩中文字幕一区二区不卡| 国产九色91中文在线视频|