开发者

How to make layout like this on Android?

How to make layout like this on Android?

Hello guys, i want to ask how to 开发者_开发知识库make a layout like this?

how to put the 3 buttons on the bottom, and the form is scrollable?

if i scroll the form, those 3 buttons still on their position (only the form will scroll)

thanks


You just create separate layout for the form and the layout should be in a scrollview. Outside the layout you can place the three buttons. For example:

<Relativelayout>
   <ScrollView>
      <LinearLayout>
      ...You can place form here
      </Linearlayout>
   </Scrollview>
   ...You can place three buttons here
</Relativelayout>

Now when you run, the three buttons will remain static and the form will be scrollable.


I just did the exact same thing. Place the following code into a linearlayout and it should do the trick.

<ScrollView 
    android:layout_width="match_parent"
    android:layout_height="1px"
    android:layout_weight="1"
    android:fillViewport="true"
>

    <LinearLayout android:id="@+id/editors"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
    />

</ScrollView>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    style="@android:style/ButtonBar"
>

    <Button android:id="@+id/btn_done"
        android:layout_width="0dip"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="@string/menu_done"
    />

    <Button android:id="@+id/btn_discard"
        android:layout_width="0dip"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="@string/menu_doNotSave"
    />

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜