私は相対レイアウトでシンプルなカードを使用しています。 相対レイアウトで使用できますか?はいの場合はどうですか?Android Studioで相対レイアウトでcardViewを使用できますか?
-2
A
答えて
1
次のようにRelativeLayout内部CardViewを使用する場合:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:background="@android:color/black"
android:layout_height="match_parent">
<android.support.v7.widget.CardView
....>
<....>//Imagine a TextView here
<....>
</android.support.v7.widget.CardView>
</RelativeLayout>
、あなたは正しい方法でcardview内の要素をarrrageすることはできません。ホルダーとしてCardViewを想像要するに
、あなたはそれが正しい方法例えば
に動作させるためにCardView内部のレイアウトを使用する必要があります:
は<android.support.v7.widget.CardView
....>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:background="@android:color/black"
android:layout_height="match_parent">
<....>//Imagine a TextView here
<....>
</RelativeLayout>
</android.support.v7.widget.CardView>
1
はい、我々は従ってください使用することができますコード:
<!-- About Panel -->
<android.support.v7.widget.CardView
android:id="@+id/cv_About"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/cv_Help"
android:layout_gravity="center"
android:elevation="3dp"
app:cardCornerRadius="0dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="@dimen/pad_20dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="@string/about"
android:textColor="@color/dimblack"
android:id="@+id/tvAbout"
/>
</RelativeLayout>
</android.support.v7.widget.CardView>
乾杯!
関連する問題
- 1. Android - 相対レイアウト
- 2. 相対レイアウトAndroid
- 3. Androidでの相対レイアウトの問題
- 4. フレームレイアウト内で相対レイアウトを使用する方法
- 5. リストビューのAndroid相対レイアウト
- 6. 相対レイアウトでレイアウトを作成
- 7. Androidでグライドを使用して背景イメージを相対レイアウトに設定する
- 8. Androidの相対レイアウトはどれくらい信頼できますか?
- 9. Androidレイアウトでの絶対サイズと相対サイズの混在 - 方法
- 10. 相対レイアウト
- 11. チタンモバイル相対レイアウト
- 12. Android scrollviewはランドスケープモードの相対レイアウトではありません
- 13. robots.txtに相対サイトマップURLを使用できますか?
- 14. Android:オリエンテーションの変更でCardViewのレイアウトを変更
- 15. 見解が私のレイアウトである超える相対レイアウトで
- 16. XML相対レイアウト
- 17. ImageButtonはアンドロイドアプリの相対レイアウトで問題
- 18. 相対的レイアウトでImageViewをプログラム的に調整できない
- 19. 相対的なレイアウトの問題/ android
- 20. Androidのレイアウト - 相対的なフレーム
- 21. curlをPHPで相対パスで使用することはできますか?
- 22. 新しいアクティビティのデフォルトレイアウトをAndroid Studioの「相対レイアウト」ではなく「リニアレイアウト」に設定します
- 23. 相対レイアウトと線形レイアウト
- 24. Androidで外部XMLファイルをレイアウト用に使用できますか?
- 25. カップルデバイスの相対レイアウト
- 26. Androidでは、レイアウトxmlのアセットからイメージを使用できますか?
- 27. 相対レイアウトで重力が設定されていません
- 28. 相対レイアウトで画像を設定する際の問題
- 29. アンドロイド:相対レイアウトの問題
- 30. アンドロイドの動的相対レイアウト
um、 'RelativeLayout'に入れてください。何を求めているのですか? –
CardViewはViewGroupに過ぎません。通常のViewGroupのように、他のビューグループで使用できます。 –