侧拉布局展示

本文详细介绍了使用Android支持库进行界面布局和UI设计的具体实践,包括DrawerLayout的配置、LinearLayout的使用、ViewPager的集成以及RadioGroup和RadioButton的样式设置。通过实例展示了如何创建交互式的UI元素,如选项按钮,并设置了背景、文本大小和对齐方式。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".activity.MainActivity">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

    <android.support.v4.view.ViewPager
        android:id="@+id/viewpager"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
       />
    <RadioGroup
        android:id="@+id/group"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:orientation="horizontal">
        <RadioButton
            android:id="@+id/q1"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:button="@null"
            android:text="努力"
            android:textSize="30dp"
            android:background="@drawable/selects"
            android:gravity="center"
            android:layout_height="wrap_content" />
        <RadioButton
            android:id="@+id/q2"
            android:background="@drawable/selects"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:button="@null"
            android:text="优秀"
            android:textSize="30dp"
            android:gravity="center"
            android:layout_height="wrap_content" />
        <RadioButton
            android:id="@+id/q3"
            android:background="@drawable/selects"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:button="@null"
            android:text="加油"
            android:textSize="30dp"
            android:gravity="center"
            android:layout_height="wrap_content" />
    </RadioGroup>
    </LinearLayout>
    <LinearLayout
        android:orientation="vertical"
        android:layout_height="match_parent"
        android:layout_width="match_parent"
        android:background="@drawable/l"
        android:layout_gravity="start">

    <LinearLayout
        android:layout_height="400dp"
        android:layout_marginTop="10dp"
        android:layout_width="match_parent"
        android:gravity="center"
        android:background="@mipmap/ic_launcher">
    </LinearLayout>

    <TextView
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        android:textSize="100dp"
        android:gravity="center"
        android:layout_marginTop="30dp"
        android:textColor="#00f"
        android:text="你最优秀"/>
        <TextView
            android:layout_height="wrap_content"
            android:layout_width="match_parent"
            android:textSize="150dp"
            android:gravity="center"
            android:layout_marginTop="50dp"
            android:textColor="#dfd345"
            android:text="你最棒"/>

</LinearLayout>


</android.support.v4.widget.DrawerLayout>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值