アンドロイドスタジオのフラグメントxmlにウェイトパラメータを追加しようとしています.2つのフラグメントがそれぞれ半分のスクリーンを取ることができますが、ウェイトを追加するとレイアウトに影響はありません。どのような興味深い私はまだここでは、通常のアクティビティビューに重みを追加することができます。ここでscreen shotアンドロイドスタジオのフラグメントにウェイトパラメーターを追加できませんか?
は私のレイアウトファイルは
<?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:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="io.designcoder.vivz.lifecycle.xml.ActivityFragmentXml">
<fragment
android:id="@+id/fragment_xml_a"
class="io.designcoder.vivz.lifecycle.xml.FragmentXmlA"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
tools:layout="@layout/fragment_xml_a"
/>
<fragment
android:id="@+id/fragment_xml_b"
class="io.designcoder.vivz.lifecycle.xml.FragmentXmlB"
android:layout_width="match_parent"
android:layout_below="@id/fragment_xml_a"
android:layout_height="wrap_content"
tools:layout="@layout/fragment_xml_b"
/>
</RelativeLayout>
フラグメントをLinearLayoutに配置します。あなたのフラグメント幅を0dpにする –
あなたのフラグメントはLinearLayoutまたはRelativeLayoutの中にありますか? – Natalia
レイアウトファイルを共有してください。 – Joshua