好漂亮而簡單:Disapearing圖像
測試代碼:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingTop="100dp">
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
app:srcCompat="@drawable/ic_dislike" />
<ImageButton
android:id="@+id/imageButton"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/imageView"
android:layout_marginTop="20dp"
app:srcCompat="@mipmap/ic_launcher" />
</RelativeLayout>
同樣的事情發生在「真實代碼」上:
<RelativeLayout
android:id="@+id/counters"
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="#FF0000"
android:gravity="center_vertical">
<RelativeLayout
android:id="@+id/views_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageButton
android:id="@+id/views_img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_margin="4dp"
android:background="#FFFF"
app:srcCompat="@drawable/ic_views" />
<TextView
android:id="@+id/views_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@id/views_img"
android:background="@color/colorAccent"
android:text="27,547"
android:textColor="#000" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/likes_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/views_layout">
<ImageButton
android:id="@+id/likes_img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:background="#FFFF"
app:srcCompat="@drawable/ic_like" />
<TextView
android:id="@+id/likes_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@id/likes_img"
android:text="1,232"
android:textColor="#000" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/dislikes_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/likes_layout">
<ImageButton
android:id="@+id/dislikes_img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:background="#FFFF"
app:srcCompat="@drawable/ic_dislike" />
<TextView
android:id="@+id/dislikes_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@id/dislikes_img"
android:text="112"
android:textColor="#000" />
</RelativeLayout>
</RelativeLayout>
<!--title and desc-->
<RelativeLayout
android:id="@+id/title_and_desc"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/title_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Fucking amazing video!!!!"
android:textColor="#000"
android:textSize="18sp" />
<TextView
android:id="@+id/desc_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/title_txt"
android:layout_marginTop="8dp"
android:maxLines="4"
android:text="Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat." />
</RelativeLayout>
活動在此時幾乎所有的註釋,因爲我不能離開圖這件事,所以我懷疑,這有什麼關係呢
可能的衝突?依賴
{
compile fileTree(dir: 'libs', include: ['*.jar'])
// androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
// exclude group: 'com.android.support', module: 'support-annotations'
// })
compile files('libs/YouTubeAndroidPlayerApi.jar')
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.google.apis:google-api-services-youtube:v3-rev182-1.22.0'
compile 'com.google.http-client:google-http-client-android:1.20.0'
compile 'com.google.api-client:google-api-client-android:1.20.0'
compile 'com.google.api-client:google-api-client-gson:1.20.0'
}
豎起大拇指注意!!!(我有o想法爲什麼它自動完成它,但無論如何,它並沒有解決問題;(.....(我還沒有測試過它與「測試代碼」,只真正的) –
所以,試着用「android:src」替換所有的「app:srcCompat」,因爲你沒有使用任何矢量drawables。 –
YAY,那是issu e !! THX爲您提供幫助。 (你應該編輯「Awnser」並添加這個「修復」) –