我正在嘗試使用Android Studio和Firebase構建我的第一個Android應用程序。我已將它全部連接起來,並且它正在顯示來自Firebase存儲的數據庫和圖像的內容。問題是,出於某種原因,我的文本沒有顯示出我添加到xml中。在帖子的底部有3個按鈕,「like」,「comment」和「re-post」,他們有一個圖標,然後是文本旁邊的文字。圖標顯示完美,但文字不會顯示出來。 這裏是「include_post_actions.xml」問題出在哪裏?文字沒有顯示在Android上,但在Android工作室的預覽中顯示
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_below="@+id/post_action_layout"
android:layout_above="@+id/include"
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:gravity="center_vertical">
<LinearLayout
android:id="@+id/post_action_buttons"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<com.like.LikeButton
app:icon_type="heart"
app:icon_size="18dp"
android:id="@+id/star_button"
android:layout_width="18dp"
android:layout_height="18dp" />
<TextView
android:id="@+id/post_likes_count"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:textColor="@color/colorBlack"
android:maxLines="1"
tools:text="Like" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
<ImageView
android:id="@+id/post_comment_icon"
android:layout_width="20dp"
android:layout_height="20dp"
android:src="@drawable/ic_question_answer_black_24dp"
/>
<TextView
android:id="@+id/post_comments_count"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:textColor="@color/colorBlack"
android:maxLines="1"
tools:text="Comment" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
<ImageView
android:id="@+id/post_repost_icon"
android:layout_width="20dp"
android:layout_height="20dp"
android:src="@drawable/ic_autorenew_black_24dp"
/>
<TextView
android:id="@+id/post_repost_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:textColor="@color/colorBlack"
android:maxLines="1"
tools:text="Repost" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/post_action_buttons">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginStart="20dp"
android:gravity="center_vertical"
tools:text="Likes Count"
android:id="@+id/like_count_text"
android:maxLines="1"
/>
</LinearLayout>
</RelativeLayout>
在預覽文本旁邊的圖標顯示出來,但是當我在模擬器上只有圖標在那裏運行它,我無法弄清楚爲什麼。請幫忙。謝謝。 Android Studio中
真棒,非常感謝你! –
工作就像一個魅力!非常感謝! –