Android仿微信布局的實(shí)現(xiàn)示例
目前沒(méi)有實(shí)現(xiàn)微信的功能,只是對(duì)微信的各個(gè)界面的調(diào)動(dòng)以及對(duì)通訊錄,發(fā)現(xiàn)和我中各個(gè)按鈕的設(shè)置,同時(shí)如果你想嘗試給微信中各個(gè)按鈕背后添加功能時(shí)間可以用此作為模板哦,如拍照,朋友圈的添加都可以在此拓展喲,這個(gè)代碼后期我會(huì)盡可能的添加對(duì)應(yīng)的按鈕的功能,希望對(duì)你們有所幫助,另外,這個(gè)代碼的部分調(diào)用沒(méi)有完成,不過(guò)我給部分的界面跳轉(zhuǎn)做過(guò)例子了,照此方法即可完成,很容易的!另外我用的方法比較笨重,但是很容易理解,也算對(duì)我們初學(xué)者做個(gè)簡(jiǎn)單參考吧!
下面是代碼部分:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity" android:background="@drawable/bj" android:orientation="vertical" > <TextView android:layout_marginTop="10dp" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="微信" android:gravity="center" android:textSize="25sp" android:textColor="#EDEEEA" /> <Button android:layout_width="match_parent" android:layout_height="65dp" android:background="@drawable/sousuo" /> <LinearLayout android:layout_marginTop="550dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal"> <Button android:id="@+id/wx" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/weixin" android:layout_weight="1" /> <Button android:id="@+id/btn1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/tongxunlu" android:layout_weight="1" /> <Button android:id="@+id/btn2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/faxian" android:layout_weight="1" /> <Button android:id="@+id/btn3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/wo" android:layout_weight="1" /> </LinearLayout> </LinearLayout>
package com.example.wechat1; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; public class MainActivity extends AppCompatActivity { private Button btn1,btn2,btn3; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); btn1=findViewById(R.id.btn1); btn2=findViewById(R.id.btn2); btn3=findViewById(R.id.btn3); btn1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent=new Intent(MainActivity.this,Main2Activity.class); startActivity(intent); } }); btn2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent=new Intent(MainActivity.this,Main3Activity.class); startActivity(intent); } }); btn3.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent=new Intent(MainActivity.this,Main4Activity.class); startActivity(intent); } }); } }
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".Main2Activity" android:orientation="vertical" android:background="@drawable/bj" > <TextView android:textColor="#EDEEEA" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="通訊錄" android:gravity="center" android:layout_marginTop="10dp" android:textSize="25sp" /> <Button android:layout_width="match_parent" android:layout_height="65dp" android:background="@drawable/sousuo" /> <Button android:layout_width="match_parent" android:layout_height="60dp" android:background="@drawable/xdpy" /> <Button android:layout_width="match_parent" android:layout_height="60dp" android:background="@drawable/jlt" /> <Button android:layout_width="match_parent" android:layout_height="60dp" android:background="@drawable/ql" /> <Button android:layout_width="match_parent" android:layout_height="60dp" android:background="@drawable/bq" /> <Button android:layout_width="match_parent" android:layout_height="60dp" android:background="@drawable/gzh" /> <LinearLayout android:layout_marginTop="240dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal"> <Button android:id="@+id/btn1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/weixin" android:layout_weight="1" /> <Button android:id="@+id/txl" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/tongxunlu" android:layout_weight="1" /> <Button android:id="@+id/btn2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/faxian" android:layout_weight="1" /> <Button android:id="@+id/btn3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/wo" android:layout_weight="1" /> </LinearLayout> </LinearLayout>
package com.example.wechat1; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; public class Main2Activity extends AppCompatActivity { private Button btn1,btn2,btn3; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main2); btn1=findViewById(R.id.btn1); btn2=findViewById(R.id.btn2); btn3=findViewById(R.id.btn3); btn1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent=new Intent(Main2Activity.this,MainActivity.class); startActivity(intent); } }); btn2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent=new Intent(Main2Activity.this,Main3Activity.class); startActivity(intent); } }); btn3.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent=new Intent(Main2Activity.this,Main4Activity.class); startActivity(intent); } }); } }
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".Main3Activity" android:orientation="vertical" android:background="@drawable/bj" > <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="發(fā)現(xiàn)" android:gravity="center" android:textSize="25sp" android:layout_marginTop="10dp" android:textColor="#EDEEEA" /> <Button android:layout_width="match_parent" android:layout_height="60dp" android:background="@drawable/pyq" /> <Button android:layout_width="match_parent" android:layout_height="110dp" android:background="@drawable/sph" /> <Button android:layout_width="match_parent" android:layout_height="110dp" android:background="@drawable/sys" /> <Button android:layout_width="match_parent" android:layout_height="110dp" android:background="@drawable/kyk" /> <Button android:layout_width="match_parent" android:layout_height="60dp" android:background="@drawable/fj" /> <Button android:layout_width="match_parent" android:layout_height="110dp" android:background="@drawable/gw" /> <Button android:layout_width="match_parent" android:layout_height="60dp" android:background="@drawable/xcx" /> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal"> <Button android:id="@+id/wx" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/weixin" android:layout_weight="1" /> <Button android:id="@+id/txl" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/tongxunlu" android:layout_weight="1" /> <Button android:id="@+id/fx" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/faxian" android:layout_weight="1" /> <Button android:id="@+id/w" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/wo" android:layout_weight="1" /> </LinearLayout> </LinearLayout>
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".Main4Activity" android:orientation="vertical" android:background="@drawable/bj" > <Button android:layout_marginTop="20dp" android:layout_width="wrap_content" android:layout_height="180dp" android:background="@drawable/w1" /> <Button android:layout_width="wrap_content" android:layout_height="60dp" android:background="@drawable/w2" /> <Button android:layout_width="wrap_content" android:layout_height="60dp" android:background="@drawable/w3" /> <Button android:layout_width="wrap_content" android:layout_height="60dp" android:background="@drawable/w4" /> <Button android:layout_width="wrap_content" android:layout_height="60dp" android:background="@drawable/w5" /> <Button android:layout_width="wrap_content" android:layout_height="60dp" android:background="@drawable/w6" /> <Button android:layout_width="wrap_content" android:layout_height="60dp" android:background="@drawable/w7" /> <Button android:layout_width="wrap_content" android:layout_height="60dp" android:background="@drawable/w8" /> </LinearLayout>
到此這篇關(guān)于Android仿微信布局的實(shí)現(xiàn)示例的文章就介紹到這了,更多相關(guān)Android 微信布局內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
Android實(shí)現(xiàn)定時(shí)器的3種方法
這篇文章主要為大家詳細(xì)介紹了Android實(shí)現(xiàn)定時(shí)器的3種方法,感興趣的小伙伴們可以參考一下2016-07-07Android簡(jiǎn)單實(shí)現(xiàn)app每月簽到功能
這篇文章主要為大家詳細(xì)介紹了Android簡(jiǎn)單實(shí)現(xiàn)app每月簽到功能,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2018-11-11android 中 SQLiteOpenHelper的封裝使用詳解
這篇文章主要介紹了android 中 SQLiteOpenHelper的封裝使用詳解,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2018-02-02Android開(kāi)發(fā)ListView中下拉刷新上拉加載及帶列的橫向滾動(dòng)實(shí)現(xiàn)方法
這篇文章主要介紹了Android開(kāi)發(fā)ListView中下拉刷新上拉加載及帶列的橫向滾動(dòng)實(shí)現(xiàn)方法的相關(guān)資料,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下2016-07-07Android自定義帶加載動(dòng)畫效果的環(huán)狀進(jìn)度條
這篇文章主要介紹了Android自定義帶加載動(dòng)畫效果的環(huán)狀進(jìn)度條,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-12-12Android使用selector修改TextView中字體顏色和背景色的方法
這篇文章主要介紹了Android使用selector修改TextView中字體顏色和背景色的方法,實(shí)例分析了selector方法的相關(guān)使用技巧,需要的朋友可以參考下2016-01-01Android Material加載進(jìn)度條制作代碼
這篇文章主要為大家詳細(xì)介紹了AndroidMaterial加載進(jìn)度條的相關(guān)資料,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-01-01Android仿泡泡窗實(shí)現(xiàn)下拉菜單條實(shí)例代碼
最近參與android的項(xiàng)目開(kāi)發(fā),其中遇到這樣的需求:點(diǎn)擊下拉按鈕,顯示出所有的條目,有刪除和點(diǎn)擊功能,點(diǎn)擊后將條目顯示。下面通過(guò)實(shí)例代碼給大家介紹下Android仿泡泡窗實(shí)現(xiàn)下拉菜單條效果,需要的朋友參考下吧2017-05-05Android 實(shí)現(xiàn)WebView點(diǎn)擊圖片查看大圖列表及圖片保存功能
這篇文章主要介紹了Android 實(shí)現(xiàn)WebView點(diǎn)擊圖片查看大圖列表及圖片保存功能,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下2017-02-02