首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Windows Tile Android布局

Windows Tile Android布局
EN

Stack Overflow用户
提问于 2014-10-16 03:34:25
回答 3查看 1.5K关注 0票数 0

我正在寻找windows 8磁贴布局在android (布局完全像windows phone磁贴用户界面..)。尝试了很多表格/网格布局。不能让它变得完美。任何帮助都将不胜感激。

EN

回答 3

Stack Overflow用户

发布于 2015-12-05 12:37:01

可能会对你有帮助。

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dip"
        android:layout_weight="0.26"
        android:orientation="horizontal" >

        <Button
            android:id="@+id/button1"
            android:layout_height="118dp"
            android:layout_weight="1.00" 
            android:paddingLeft="50dp"/>

        <Button
            android:id="@+id/button2"
            android:layout_width="156dp"
            android:layout_height="122dp" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dip"
        android:layout_weight="0.84"
        android:orientation="horizontal" >

        <Button
            android:id="@+id/button3"
            android:layout_width="0dip"
            android:layout_height="118dp"
            android:layout_weight="1.00" />

        <Button
            android:id="@+id/button4"
            android:layout_width="156dp"
            android:layout_height="122dp" />
    </LinearLayout>

</LinearLayout>
票数 0
EN

Stack Overflow用户

发布于 2015-12-05 12:39:28

试着这样做可能是这样的

代码语言:javascript
复制
<com.felipecsl.asymmetricgridview.library.widget.AsymmetricGridView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/listView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>

MainActivity.java

代码语言:javascript
复制
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    listView = (AsymmetricGridView) findViewById(R.id.listView);

    // Choose your own preferred column width
    listView.setRequestedColumnWidth(Utils.dpToPx(this, 120));
    final List<AsymmetricItem> items = new ArrayList<>();

    // initialize your items array
    adapter = new ListAdapter(this, listView, items);
    AsymmetricGridViewAdapter asymmetricAdapter =
        new AsymmetricGridViewAdapter<>(this, listView, adapter);
    listView.setAdapter(asymmetricAdapter);
}

有关更多信息,请参阅here

票数 0
EN

Stack Overflow用户

发布于 2018-04-10 01:49:52

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dip"
        android:layout_weight="3"
        android:orientation="horizontal">

        <android.support.v7.widget.AppCompatImageView
            android:layout_width="0dip"
            android:layout_height="match_parent"
            android:layout_margin="5sp"
            android:background="@color/backPink"
            android:layout_weight="1" />

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dip"
        android:layout_weight="5"
        android:orientation="horizontal">
        <LinearLayout
            android:layout_width="0dip"
            android:layout_height="match_parent"
            android:orientation="vertical"
            android:layout_weight="1">

            <TextView
                android:layout_width="match_parent"
                android:layout_height="0dip"
                android:layout_margin="5sp"
                android:layout_weight="3"
                android:background="@color/dark_green" />
            <TextView
                android:layout_width="match_parent"
                android:layout_height="0dip"
                android:layout_margin="5sp"
                android:layout_weight="1"
                android:background="@color/dark_blue" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="0dip"
            android:layout_height="match_parent"
            android:orientation="vertical"
            android:layout_weight="1">

            <TextView
                android:layout_width="match_parent"
                android:layout_height="0dip"
                android:layout_margin="5sp"
                android:layout_weight="1"
                android:background="@color/Teal" />
            <TextView
                android:layout_width="match_parent"
                android:layout_height="0dip"
                android:layout_margin="5sp"
                android:layout_weight="1"
                android:background="@color/purple" />
        </LinearLayout>
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dip"
        android:layout_margin="5sp"
        android:layout_weight="1"
        android:background="@color/orange"
        android:orientation="horizontal">

        <TextView
            android:layout_width="0dip"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:gravity="center_vertical|center"
            android:text="Logout"
            android:textSize="30sp" />

    </LinearLayout>
</LinearLayout>

Click Here to view output

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26390630

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档