Android学习随笔(10)------碎片Fragement

电玩女神 2022-06-06 09:16 279阅读 0赞

学习流程来自《第一行代码》(第二版)
不仅仅是手机在使用Android系统,Android系统也被许多的平板使用着,这就出现了一个问题,两种设备的屏幕大小,比例都是有着巨大差别的,难道要为一个应用写两套代码来适配一个应用吗?
这是一件十分耗费时间的事情。所以这里引入了碎片的概念。
碎片(Fragment)是一种可以嵌入在活动当中的UI片段,可包含布局,有自己的生命周期,是一个迷你型的活动。

碎片的使用

新建两个布局文件。
left_fragment.xml :

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent">
  3. <Button android:id="@+id/button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:text="Button"/>
  4. </LinearLayout>

一个线性布局中包含了一个button。
right_fragment.xml :

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#00ff00">
  3. <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:textSize="20sp" android:text="This is right fragment" />
  4. </LinearLayout>

一个背景色为绿的线性布局,头部中间显示一段文字。
再新建两个类都继承Fragment(import android.support.v4.app.Fragment;继承这个包下的Fragment类,不需要导入)。

LeftFragment.java :

  1. public class left_fragment extends Fragment {
  2. @Override
  3. public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  4. View view = inflater.inflate(R.layout.left_fragment,container,false);
  5. return view;
  6. }
  7. }

通过LayoutInflater.inflate()方法动态加载left_fragment布局。

RightFragment.java

  1. public class right_fragment extends Fragment {
  2. @Override
  3. public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  4. View view = inflater.inflate(R.layout.right_fragment,container,false);
  5. return view;
  6. }
  7. }

主页面的布局文件 :

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="match_parent" >
  3. <fragment android:id="@+id/left_fragment" android:name="com.example.yezhou.com.fragmenttest.left_fragment" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1"/>
  4. <fragment android:id="@+id/right_fragment" android:name="com.example.yezhou.com.fragmenttest.right_fragment" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" />
  5. </LinearLayout>

需要通过android:name属性来显示指明要添加的碎片类名,将类的包名也带上。

Exler
不需要再MainActivity.java中添加代码。

动态添加碎片

新建一个another_right_fragment.xml

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:background="#ffff00" android:layout_width="match_parent" android:layout_height="match_parent" >
  3. <TextView android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="center_horizontal" android:textSize="20sp" android:text="This is another right fragment"/>
  4. </LinearLayout>

布局基本与right_fragment.xml相同,背景色改为黄色。
并写AnotherRightFragment类与新添加的碎片绑定。

  1. public class AnotherRightFragment extends Fragment {
  2. @Override
  3. public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  4. View view = inflater.inflate(R.layout.another_right_fragment,container,false);
  5. return view;
  6. }
  7. }

并对activity_main.java 右侧的Layout进行编辑 :

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="match_parent" >
  3. <fragment android:id="@+id/left_fragment" android:name="com.example.yezhou.com.fragmenttest.left_fragment" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1"/>
  4. <FrameLayout android:id="@+id/right_layout" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1">
  5. </FrameLayout>
  6. </LinearLayout>
  7. public class MainActivity extends AppCompatActivity implements View.OnClickListener{
  8. int id = 1;
  9. @Override
  10. protected void onCreate(Bundle savedInstanceState) {
  11. super.onCreate(savedInstanceState);
  12. setContentView(R.layout.activity_main);
  13. Button button = (Button) findViewById(R.id.button);
  14. button.setOnClickListener(this);
  15. replaceFragment(); // new right_fragment // 1.创建待添加碎片实例
  16. }
  17. @Override
  18. public void onClick(View v) {
  19. switch (v.getId()) {
  20. case R.id.button:
  21. replaceFragment();
  22. break;
  23. default:
  24. break;
  25. }
  26. }
  27. private void replaceFragment() { // Fragment fragment 实现点击button就可以在两个fragmentview里面切换
  28. FragmentManager fragmentManager = getSupportFragmentManager(); // 2.获取fragmentManager,在活动中可以直接通过调用getSupportFragmentManager()方法得到
  29. FragmentTransaction transaction = fragmentManager.beginTransaction(); // 3.开启一个事务,通过beginTransaction()方法开启
  30. switch (id) {
  31. case 1:
  32. transaction.replace(R.id.right_layout,new right_fragment()); // 4.向容器内添加或替换碎片,一般使用replace()方法实现,需要传入容器的id和待添加碎片的实例
  33. id --;
  34. break;
  35. case 0:
  36. transaction.replace(R.id.right_layout,new AnotherRightFragment());
  37. id ++;
  38. break;
  39. }
  40. transaction.commit(); // 提交事务,调用commit()方法来完成
  41. }
  42. }

代码动态添加碎片的大致流程为 :

  1. 创建待添加碎片的实例
  2. 靠getSupportFragmentManager()获取FargmentManager的实例
  3. 开启事务beginTransaction()
  4. 向内容器内添加或替换碎片replace(容器的id, 待添加碎片的实例)
  5. 提交事务commit()

此代码实现点击Button之后可以进行两个碎片之间的来回切换。
Exler

Exler
当按下返回键时,会发现我们会直接退出app,并不能返回上一个碎片。这里利用FragmentTransaction中的addToBackStack()方法。
修改MainActivity.java :

  1. package com.example.yezhou.com.fragmenttest;
  2. import android.support.v4.app.Fragment;
  3. import android.support.v4.app.FragmentManager;
  4. import android.support.v4.app.FragmentTransaction;
  5. import android.support.v7.app.AppCompatActivity;
  6. import android.os.Bundle;
  7. import android.view.View;
  8. import android.widget.Button;
  9. public class MainActivity extends AppCompatActivity implements View.OnClickListener{
  10. int id = 1;
  11. @Override
  12. protected void onCreate(Bundle savedInstanceState) {
  13. super.onCreate(savedInstanceState);
  14. setContentView(R.layout.activity_main);
  15. Button button = (Button) findViewById(R.id.button);
  16. button.setOnClickListener(this);
  17. replaceFragment(new right_fragment()); // new right_fragment // 1.创建待添加碎片实例
  18. }
  19. @Override
  20. public void onClick(View v) {
  21. switch (v.getId()) {
  22. case R.id.button:
  23. replaceFragment(new AnotherRightFragment());
  24. break;
  25. default:
  26. break;
  27. }
  28. }
  29. private void replaceFragment(Fragment fragment) { // 模拟返回栈 按下back返回到上一个碎片
  30. FragmentManager fragmentManager = getSupportFragmentManager();
  31. FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
  32. fragmentTransaction.replace(R.id.right_layout, fragment);
  33. fragmentTransaction.addToBackStack(null); // 接收一个名字用于描述返回栈的状态
  34. fragmentTransaction.commit();
  35. }
  36. }

此代码没有实现点击button两碎片之间来回切换,但是按下返回键时会返回上一个碎片。实现碎片中模拟返回栈。

碎片的生命周期

既然碎片是一个迷你型的活动,那么跟活动定是有相同的地方,除了上面基础中的一些东西之外,碎片也有自己的生命周期。
Exler
用代码运行程序来理解一下 :

  1. public class right_fragment extends Fragment {
  2. public static final String TAG = "admin";
  3. @Override
  4. public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  5. Log.d(TAG, "onCreateView");
  6. View view = inflater.inflate(R.layout.right_fragment,container,false);
  7. return view;
  8. }
  9. @Override
  10. public void onAttach(Context context) {
  11. super.onAttach(context);
  12. Log.d(TAG, "onAttach()");
  13. }
  14. @Override
  15. public void onCreate(@Nullable Bundle savedInstanceState) {
  16. super.onCreate(savedInstanceState);
  17. Log.d(TAG, "onCreate()");
  18. }
  19. @Override
  20. public void onActivityCreated(@Nullable Bundle savedInstanceState) {
  21. super.onActivityCreated(savedInstanceState);
  22. Log.d(TAG, "onActivityCreated()");
  23. }
  24. @Override
  25. public void onStart() {
  26. super.onStart();
  27. Log.d(TAG, "onStart()");
  28. }
  29. @Override
  30. public void onResume() {
  31. super.onResume();
  32. Log.d(TAG, "onResume()");
  33. }
  34. @Override
  35. public void onPause() {
  36. super.onPause();
  37. Log.d(TAG, "onPause()");
  38. }
  39. @Override
  40. public void onStop() {
  41. super.onStop();
  42. Log.d(TAG, "onStop()");
  43. }
  44. @Override
  45. public void onDestroyView() {
  46. super.onDestroyView();
  47. Log.d(TAG, "onDestroyView()");
  48. }
  49. @Override
  50. public void onDestroy() {
  51. super.onDestroy();
  52. Log.d(TAG, "onDestroy()");
  53. }
  54. @Override
  55. public void onDetach() {
  56. super.onDetach();
  57. Log.d(TAG, "onDetach()");
  58. }
  59. }

这是刚运行时的Log输出信息 :
Exler
依次执行onAttach()、onCreate()、onCreateView()、onActivityCreated()、
onStart()、onResume()
点击button :
Exler
AnotherRightFragment替代掉了RightFragment,RightFragment进入了停止状态,onPause()、onStop()、onDestroyView() 依次得到执行。
点击back键 :
Exler
可以看到onCreateView()、onActivityCreated()、onStart()、onResume()依次得到调用,RightFragment重新回到运行状态。
再次点击back键 :
Exler
可以看到RightFragment被销毁,onpause()、onStop()、onDestroyView()、onDestroy()、onDetach()依次被调用。

动态加载布局的技巧

利用限定符来实现根据不同设备分辨率或屏幕大小在运行时来决定加载哪个布局。
很多时候相同的App在平板和手机上显示的内容布局是不一样的,利用限定符就可以来判断程序应该使用哪个显示模式。
更改activity_main布局文件

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="match_parent" >
  3. <fragment android:id="@+id/left_fragment" android:name="com.example.yezhou.com.fragmenttest.left_fragment" android:layout_width="match_parent" android:layout_height="match_parent" />
  4. </LinearLayout>

只留下左边的碎片,并充满整个布局。 为单页模式下的布局。

在res下新建layout-large文件夹,在此目录下新建一个actvity_main.xml

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="match_parent">
  3. <fragment android:id="@+id/left_fragment" android:name="com.example.yezhou.com.fragmenttest.left_fragment" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent"/>
  4. <fragment android:id="@+id/right_fragment" android:name="com.example.yezhou.com.fragmenttest.right_fragment" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="3" /> <!--android:name显示指明要添加的碎片类名一定要将类的包名也加上-->
  5. </LinearLayout>

此布局文件中包含了两个碎片,即双页模式。
其中large为限定符,屏幕被认为是large的设备就会自动加载layout-large下的布局文件。
注释掉主页面java文件中的fragmentTransaction.replace(R.id.right_layout, fragment);
运行
可以看到手机的结果为 :
Exler
在平板下的运行结果 :
Exler
利用layout-large虽然可以在大屏幕上进行分页显示,但是怎样的屏幕会被定义为大,我们难以知晓。
最小宽度限定符(Smallest-width Qualifier)
layout-sw600dp 指屏幕宽度小于这个值的设备就加载另一个布局。

利用碎片的实践

实现一个简单的新闻应用。利用RecyclerView来显示所有新闻的标题
导包

  1. compile 'com.android.support:recyclerview-v7:26.0.0-alpha1'

定义一个新闻类 :

  1. public class News {
  2. private String title;
  3. private String content;
  4. public String getTitle() {
  5. return title;
  6. }
  7. public String getContent() {
  8. return content;
  9. }
  10. public void setTitle(String title) {
  11. this.title = title;
  12. }
  13. public void setContent(String content) {
  14. this.content = content;
  15. }
  16. }

新建布局news_content_frag.xml 用于显示新闻内容的碎片

  1. <?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"> <LinearLayout android:id="@+id/visibility_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:visibility="invisible"><!--不可见--> <TextView android:id="@+id/news_title" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" android:padding="10dp" android:textSize="20sp" /> <View android:layout_width="match_parent" android:layout_height="1dp" android:background="#000" /> <TextView android:id="@+id/news_content" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:padding="15dp" </LinearLayout><!--头部分显示新闻标题,正文部分显示新闻内容中间用一条细线隔开--> <View android:layout_width="1dp" android:layout_height="match_parent" android:layout_alignParentLeft="true" android:background="#000" /> </RelativeLayout>

利用view height设为1dp来实现显示一条黑线,

新建一个类来控制新闻内容布局 :

  1. public class NewsContentFragment extends Fragment {
  2. private View view;
  3. @Override
  4. public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  5. view = inflater.inflate(R.layout.news_content_frag,container,false);
  6. return view;
  7. }
  8. public void refresh(String newsTitle, String newsContent) {
  9. View visibilityLayout = view.findViewById(R.id.visibility_layout);
  10. visibilityLayout.setVisibility(View.VISIBLE);
  11. TextView newsTitleText = (TextView) view.findViewById(R.id.news_title);
  12. TextView newsContentText = (TextView) view.findViewById(R.id.news_content);
  13. newsTitleText.setText(newsTitle);
  14. newsContentText.setText(newsContent);
  15. }
  16. }

onCreateView()方法中把类与布局绑定,在refresh()中将新闻标题内容显示在界面上。
再创建一个Empty Activity,新建NewContentActivity,布局名改为news_content,更改布局 :

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent">
  3. <fragment android:id="@+id/news_content_fragment" android:name="com.example.yezhou.com.fragmentbestpractice.NewsContentFragment" android:layout_width="match_parent" android:layout_height="match_parent" /><!--直接在布局中引入来NewsContentFragment,相当于把news_contentfrag布局内容自动加来进来-->
  4. </LinearLayout>

修改NewContentActivity :

  1. public class NewsContentActivity extends AppCompatActivity {
  2. @Override
  3. protected void onCreate(Bundle savedInstanceState) {
  4. super.onCreate(savedInstanceState);
  5. setContentView(R.layout.news_content);
  6. String newsTitle = getIntent().getStringExtra("news_title");
  7. String newsContent = getIntent().getStringExtra("news_content");
  8. NewsContentFragment newsContentFragment = (NewsContentFragment) getSupportFragmentManager().findFragmentById(R.id.news_content_fragment);
  9. newsContentFragment.refresh(newsTitle,newsContent);
  10. }
  11. public static void actionStart(Context context, String newsTitle, String newsContent) { // 由上一个活动调用,传入要传给这个活动的值
  12. Intent intent = new Intent(context,NewsContentActivity.class);
  13. intent.putExtra("news_title",newsTitle);
  14. intent.putExtra("news_content",newsContent);
  15. context.startActivity(intent);
  16. }
  17. }

利用上一个活动的Intent把对应的值传入到此碎片,再在碎片中显示出来。
创建一个显示新闻列表的布局

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent">
  3. <android.support.v7.widget.RecyclerView android:id="@+id/news_title_recycler_view" android:layout_width="match_parent" android:layout_height="match_parent" />
  4. </LinearLayout>

item :

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/news_title" android:layout_width="match_parent" android:layout_height="wrap_content" android:singleLine="true" android:ellipsize="end" android:textSize="18sp" android:paddingLeft="10dp" android:paddingRight="10dp" android:paddingTop="15dp" android:paddingBottom="15dp" />

activity_main.xml
显示单页模式下的内容

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/news_title_layout" android:layout_width="match_parent" android:layout_height="match_parent" >
  3. <fragment android:id="@+id/news_title_fragment" android:name="com.example.yezhou.com.fragmentbestpractice.NewsTitleFragment" android:layout_width="match_parent" android:layout_height="match_parent"/>
  4. </FrameLayout>

新建layout-sw600dp文件夹,再创建一个activity_main.xml :

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="match_parent">
  3. <fragment android:id="@+id/news_title_fragment" android:name="com.example.yezhou.com.fragmentbestpractice.NewsTitleFragment" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1"/>
  4. <FrameLayout android:id="@+id/news_content_layout" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="3" >
  5. <fragment android:id="@+id/news_content_fragment" android:name="com.example.yezhou.com.fragmentbestpractice.NewsContentFragment" android:layout_width="match_parent" android:layout_height="match_parent" />
  6. </FrameLayout>
  7. </LinearLayout>

此布局为双页显示下的布局,左边显示的是新闻的标题(NewsTitleFragment此类与RecyclerView相绑定news_title_frag、news_itme),右边显示的是新闻的具体内容。

创建NewsTitleFragment用于显示新闻列表的碎片

  1. public class NewsTitleFragment extends Fragment {
  2. private boolean isTwoPane;
  3. @Override
  4. public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  5. View view = inflater.inflate(R.layout.news_title_frag,container,false); // this error
  6. RecyclerView newsTitleRecyclerView = (RecyclerView) view.findViewById(R.id.news_title_recycler_view);
  7. LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
  8. newsTitleRecyclerView.setLayoutManager(layoutManager);
  9. NewsAdapter adapter = new NewsAdapter(getNews());
  10. newsTitleRecyclerView.setAdapter(adapter);
  11. return view;
  12. }
  13. @Override
  14. public void onActivityCreated(Bundle savedInstanceState) {
  15. super.onActivityCreated(savedInstanceState);
  16. if (getActivity().findViewById(R.id.news_content_layout) != null) { // this error
  17. isTwoPane = true;
  18. } else {
  19. isTwoPane =false;
  20. }
  21. }
  22. private List<News> getNews() {
  23. List<News> newsList = new ArrayList<>();
  24. for (int i = 1; i <= 50; i++) {
  25. News news = new News();
  26. news.setTitle("This is news title " + i);
  27. news.setContent(getRandomLengthContent("This is news content " + i + "."));
  28. newsList.add(news);
  29. }
  30. return newsList;
  31. }
  32. private String getRandomLengthContent(String content) {
  33. Random random = new Random();
  34. int length = random.nextInt(20) + 1;
  35. StringBuilder builder = new StringBuilder();
  36. for (int i = 0; i < length; i++) {
  37. builder.append(content);
  38. }
  39. return builder.toString();
  40. }
  41. class NewsAdapter extends RecyclerView.Adapter<NewsAdapter.ViewHolder> { // 可以直接访问NewsTitleFragment的变量
  42. private List<News> mNewsList;
  43. class ViewHolder extends RecyclerView.ViewHolder {
  44. TextView newsTitleText;
  45. public ViewHolder(View view) {
  46. super(view);
  47. newsTitleText = (TextView) view.findViewById(R.id.news_title);
  48. }
  49. }
  50. public NewsAdapter(List<News> newsList) {
  51. mNewsList = newsList;
  52. }
  53. @Override
  54. public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
  55. View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.news_item, parent, false);
  56. final ViewHolder holder = new ViewHolder(view);
  57. view.setOnClickListener(new View.OnClickListener() {
  58. @Override
  59. public void onClick(View v) {
  60. News news = mNewsList.get(holder.getAdapterPosition());
  61. int a = holder.getAdapterPosition();
  62. Log.d("admin","Position:"+a);
  63. if (isTwoPane) { // 如果是双页模式,则刷新NewsContentFragment中的内容
  64. NewsContentFragment newsContentFragment = (NewsContentFragment) getFragmentManager().findFragmentById(R.id.news_content_fragment);
  65. newsContentFragment.refresh(news.getTitle(),news.getContent());
  66. } else {
  67. Log.d("admin", "title:"+news.getTitle() + "content:" + news.getContent());
  68. NewsContentActivity.actionStart(getActivity(), news.getTitle(), news.getContent());
  69. }
  70. }
  71. });
  72. return holder;
  73. }
  74. @Override
  75. public void onBindViewHolder(ViewHolder holder, int position) {
  76. News news = mNewsList.get(position);
  77. holder.newsTitleText.setText(news.getTitle());
  78. }
  79. @Override
  80. public int getItemCount() {
  81. return mNewsList.size();
  82. }
  83. }
  84. }
  1. 在onCreateView()方法中加载news_title_frag布局,title列表的绑定,
  2. 在onActivityCreated()方法通过在活动中寻找news_content_layoutd(NewsContentActivity)的View类判断单双页模式,如果系统创建的是layout-sw600dp下的主布局文件,那么会出现内容的View,而如果的是layout下的布局文件的话,其下只有一个Title碎片会显示出来。
  3. 建一个内部类作为标题列表的适配器,在ViewHolder中存放标题信息,判断为双页模式时点击item,显示相应item的具体内容;为单页模式,点击item时直接启动NewContentActivity。

手机端的显示效果 :
Exler
点击item :
Exler

平板下的显示效果 :
Exler

Exler


此博文为个人学习笔记,仅供个人学习使用,希望对大家有帮助。

发表评论

表情:
评论列表 (有 0 条评论,279人围观)

还没有评论,来说两句吧...

相关阅读

    相关 Android学习随笔(1)

    学习流程来自《第一行代码》(第二版) 最近开始了Android的学习,看到很多人都推荐这一本书,就决定按照这一本书的讲解流程熟悉一下Android。 环境配置 ![