個人筆記(第四篇)

今天主要是遇到了三個問題。

第一個:屏幕適配,這個真的需要好好學了,雖然做出來了,但是效果簡直就是強形拼上去的樣子,多多注意;

第二個:沉浸佈局,網上找了很多方法,然後也解決了,但是總感覺解決的方式有點投機取巧,網址這裏了

http://blog.csdn.net/qq_38500074/article/details/72783041

第三個:把Activity變成懸浮框,並設置其大小,以及空白處點擊事件:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/activity_person_track_view"
    android:gravity="center_vertical|center_horizontal"
    tools:context="com.example.administrator.qinghuayuan.person.PersonTrackActivity"
    >
    <RelativeLayout
        android:layout_width="@dimen/DIMEN_360PX"
        android:layout_height="@dimen/DIMEN_600PX"
        android:gravity="center">
 </RelativeLayout>
</RelativeLayout>

然後在對應的Activity添加對整個View的點擊監聽。由於是限制了大小和位置的,所以會留出空白,空白的地方就是點擊的地方了

 relativeLayout=(RelativeLayout)findViewById(R.id.activity_person_track_view);
        relativeLayout.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public
            boolean onTouch(View v, MotionEvent event) {
                finish();
                return false;
            }
        });

暫時就到這裏吧.哦,對了,祝大家端午節快樂啊,好好休息,放鬆一下去吧
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章