欧美三区_成人在线免费观看视频_欧美极品少妇xxxxⅹ免费视频_a级毛片免费播放_鲁一鲁中文字幕久久_亚洲一级特黄

新浪微博Android客戶端學(xué)習(xí)記錄三:完成登錄界

系統(tǒng) 1908 0

本講完成的效果為:

新浪微博Android客戶端學(xué)習(xí)記錄三:完成登錄界面和授權(quán)界面

登錄界面的布局代碼(login.xml)為:

    <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/main_bg"
    android:orientation="vertical" >

    <Button
        android:id="@+id/btn_add_accountn"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="right"
        android:layout_marginRight="10dip"
        android:layout_marginTop="10dip"
        android:background="@drawable/add_account_d" />

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:background="@drawable/head_bg"
        android:gravity="center"
        android:layout_marginTop="20dip"
        android:orientation="vertical" >

        <ImageView
            android:id="@+id/imge_user_head"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/user_head" />
    </LinearLayout>

    <Spinner
        android:id="@+id/spn_user_list"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/account_selete_bg"
        android:layout_gravity="center"
        android:layout_marginTop="10dip" />
    
    <Button
        android:id="@+id/btn_login"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_marginTop="10dip"
        android:background="@drawable/login_d"
        android:text="@string/login"
        android:textColor="@color/white"
        android:textSize="20dip" />

</LinearLayout>
  

授權(quán)界面的布局(auth.xml)代碼

    <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/main_bg" >
</LinearLayout>
  

授權(quán)界面中的子界面(authorize_dialog.xml)文件

    <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:padding="15dip" >

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/info" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="5dip"
            android:text="@string/authTip"
            android:textColor="@color/black"
            android:textSize="18dip" />
    </LinearLayout>

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="5dip"
        android:layout_marginRight="5dip"
        android:layout_marginTop="10dip"
        android:text="@string/authTipMsg"
        android:textSize="15dip" />

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:layout_alignParentBottom="true"
         >

        <Button
            android:id="@+id/btn_auth_begin"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginTop="10dip"
            android:background="@drawable/auth_begin_d"
            android:textColor="@color/white"
            android:textSize="20dip" />
    </RelativeLayout>

</LinearLayout>
  

然后再增加一個(gè)Activity(AuthActivity)就可以實(shí)現(xiàn)一個(gè)漂亮的界面啦

    package haiyang.project.iweibo.ui;

import haiyang.project.iweibo.R;
import android.app.Activity;
import android.app.Dialog;
import android.os.Bundle;
import android.view.View;

public class AuthActivity extends Activity{

	private Dialog dialog;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		
		this.setContentView(R.layout.auth);
		
		View digView=View.inflate(this, R.layout.authorize_dialog, null);
		
		dialog=new Dialog(this, R.style.auth_dialog);
		dialog.setContentView(digView);
		dialog.show();
	}
}
  

在實(shí)際的按鈕點(diǎn)擊過程中,點(diǎn)擊和松開后應(yīng)該為兩種不同的狀態(tài),這樣子點(diǎn)擊時(shí)才有點(diǎn)擊感,具體的實(shí)現(xiàn)為在res下新建drawable的文件夾,增加一個(gè)布局(login.xml)文件

    <?xml version="1.0" encoding="utf-8"?>
<selector
  xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_focused="true" android:state_enabled="true" android:state_pressed="false" android:drawable="@drawable/btn_bg_n" />
    <item android:state_enabled="true" android:state_pressed="true" android:drawable="@drawable/btn_bg_p" />
    <item android:state_enabled="true" android:state_checked="true" android:drawable="@drawable/btn_bg_p" />
    <item android:drawable="@drawable/btn_bg_n" />
</selector>

  

這個(gè)文件可以實(shí)現(xiàn)點(diǎn)擊和松開某個(gè)按鈕時(shí)分別為不同的圖像,涉及到類似功能實(shí)現(xiàn)的操作都是用這種方法,此講中用到三處(一個(gè)登錄按鈕、一個(gè)下拉框、一個(gè)開始按鈕),由于類似,此文不一一列出。

再就是讓授權(quán)界面的提示文字友好的顯示(authorize_dialog_style):

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

    <style name="auth_dialog" parent="@android:style/Theme.Dialog">
        <item name="android:windowFrame">@null</item>
 <!-- Dialog的windowFrame框?yàn)闊o -->
        <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">@drawable/dialog_bg</item>
        <item name="android:backgroundDimEnabled">false</item>
    </style>

</resources>
  

總結(jié)一下,本講學(xué)習(xí)到得新內(nèi)容為:實(shí)現(xiàn)點(diǎn)擊按鈕(或下拉框)等操作時(shí)兩種不同狀態(tài)的不同效果,以及使界面更友好。

新浪微博Android客戶端學(xué)習(xí)記錄三:完成登錄界面和授權(quán)界面


更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯(lián)系: 360901061

您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長非常感激您!手機(jī)微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會(huì)非常 感謝您的哦!!!

發(fā)表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 草草视频免费在线观看 | 久久九九99热这里只有精品 | 国产精品免费一区 | 日本肥老太成熟 | 久久久久久久久久综合情日本 | 欧美激情人成日本在线视频 | 日韩在线1 | 久9视频这里只有精品8 | 亚洲精品一区二区三区四区高清 | 久久久久久亚洲 | 亚洲 欧美 日韩 在线 香蕉 | 亚洲97视频 | 宅男lu666噜噜噜在线观看 | 日本高清不卡在线 | 欧美激情欧美激情在线五月 | 精品一区二区三区在线视频 | 在线观看www| 波多野结衣手机在线播放 | 国产成人在线视频 | 91免费永久国产在线观看 | 超碰人人操| 国产成年网站v片在线观看 中文字幕在线免费视频 | 黄色资源在线观看 | 亚洲精品一区中文字幕乱码 | jizz日| 久久精品成人免费国产片桃视频 | 欧美一区二区三区免费不卡 | 日本国产视频 | 国产一区二区三区免费 | 无遮挡啪啪成人免费网站 | 亚洲综合国产 | 亚洲福利电影网 | 三级黄色片在线观看 | 国产一区二 | 中文字幕视频在线观看 | 亚洲成人激情av | 日韩一道本 | 国产 一区 | 国产精品一级香蕉一区 | 国产精品久久久AV久久久 | 国产成人免费 |