Android 尝试创建正确布局时出现的问题
提前道歉,但我无法发布我的代码,因为我的笔记本电脑包含Android Studio,无法访问互联网。我正在用一台有局域网的电脑来发布这个问题。我会展示我的代码并要求进行操作,但由于我无法发布我的代码,我只需要要求提供一个基本示例,看看如何将其应用于xml文件 基本上,我正在尝试为我的应用程序创建布局,我希望它显示为: 我目前在布局方面有问题,所以想知道我是否可以看到基本布局,以便查看并应用于xml文件 谢谢,那么基本上是这样吗Android 尝试创建正确布局时出现的问题,android,Android,提前道歉,但我无法发布我的代码,因为我的笔记本电脑包含Android Studio,无法访问互联网。我正在用一台有局域网的电脑来发布这个问题。我会展示我的代码并要求进行操作,但由于我无法发布我的代码,我只需要要求提供一个基本示例,看看如何将其应用于xml文件 基本上,我正在尝试为我的应用程序创建布局,我希望它显示为: 我目前在布局方面有问题,所以想知道我是否可以看到基本布局,以便查看并应用于xml文件 谢谢,那么基本上是这样吗 <LinearLayout android:orienta
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="100dp">
<TextView
android:id="@+id/Title"
android:layout_width="0dp"
android:layout_weight="2"
android:layout_height="wrap_content"
android:text="some title"
android:textColor="@color/white"
android:textStyle="bold" />
<imageView
android:layout_width="0dp"
android:layout_weight="2"
android:layout_height="wrap_content"/>
<Button
android:layout_width="0dp"
android:layout_weight="2"
android:layout_height="wrap_content"/>
</LinearLayout>
<TextView
android:id="@+id/mainText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="some text"
android:textColor="@color/white"
android:textStyle="bold" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity:"right"/>
</LinearLayout>
尝试使用嵌套布局。一旦你理解了它的意思,你就会自己找到一个合适的组合 下面是一个例子,它会使你的形象更加完美:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:orientation="horizontal"
android:weightSum="3"
android:id="@+id/L_laouyout_1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Game Title"
android:id="@+id/tv_1"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:id="@+id/iv_1"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Back"
android:id="@+id/btn_1"/>
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="50dp"
android:id="@+id/tv_2"
android:text="Main Text"
android:layout_below="@+id/L_laouyout_1" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/btn_2"
android:text="Select another"
android:layout_below="@+id/tv_2"
android:layout_alignParentRight="true" />
</RelativeLayout>
不错的尝试!( •_•) - ( •_•)>⌐■-■ - (⌐■_■)谢谢你的回答,另一个答案对我有用,但我很感激你对我问题的回答