【问题标题】:Trying to view my XML in "Graphical Layout" Tab尝试在“图形布局”选项卡中查看我的 XML
【发布时间】:2012-02-24 17:05:46
【问题描述】:

我一直在使用 XML 尝试通过更改 int 来排列按钮。值,然后查看它在我的手机上的外观。我试图让 XML 显示在 Eclipse 上的“图形布局”选项卡上,但没有成功。我是否需要在 XML 文件中添加一些内容以使其显示在“图形布局”选项卡上,或者这是我的 eclipse 上的某种设置错误?

我已经尝试了@这个链接上的所有解决方案:Graphical layout missing for Layout XML Files

这是有问题的 XML 文件,这是我看到的屏幕截图:http://snag.gy/6H0v6.jpg

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/persona_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="5dp" >

<TextView
    android:id="@+id/persona_marquee"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:ellipsize="marquee"
    android:focusable="true"
    android:gravity="center"
    android:marqueeRepeatLimit="marquee_forever"
    android:maxLines="1"
    android:scrollHorizontally="true"
    android:textColor="#f0f0f0f0"
    android:textSize="26sp"
    android:textStyle="bold"
    android:visibility="gone" >
</TextView>

<ImageView
    android:id="@+id/persona_img"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:keepScreenOn="true" >
</ImageView>

<TextView
    android:id="@+id/persona_misctxt"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:visibility="gone" >
</TextView>

<LinearLayout
    android:id="@+id/persona_scorebox"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="center"
    android:orientation="horizontal"
    android:visibility="gone" >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/your_score"
        android:textSize="16sp"
        android:textStyle="bold" >
    </TextView>

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/rate_star_big_on" />

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/rate_star_big_on" />

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/rate_star_big_on" />

    <ImageView
        android:id="@+id/persona_star4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/rate_star_big_on"
        android:visibility="gone" />

    <ImageView
        android:id="@+id/persona_halfstar4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/rate_star_big_half"
        android:visibility="gone" />

    <ImageView
        android:id="@+id/persona_star5"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/rate_star_big_on"
        android:visibility="gone" />

    <ImageView
        android:id="@+id/persona_halfstar5"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/rate_star_big_half"
        android:visibility="gone" />

    <ImageView
        android:id="@+id/persona_star5empty"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/rate_star_big_off"
        android:visibility="gone" />
</LinearLayout>

<LinearLayout
    android:id="@+id/textbox"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="2"
    android:gravity="center"
    android:orientation="horizontal"
    android:visibility="gone" >

    <TextView
        android:id="@+id/persona_nametxt"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center_vertical"
        android:paddingRight="7dp"
        android:textSize="16sp"
        android:textStyle="bold" >
    </TextView>

    <TextView
        android:id="@+id/persona_desctxt"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center_vertical"
        android:textSize="14sp" >
    </TextView>
</LinearLayout>

<RelativeLayout
    android:id="@+id/persona_statbars"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:visibility="gone" >

    <TextView
        android:id="@+id/statlabel1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="5dp"
        android:ellipsize="end"
        android:maxLines="1"
        android:paddingLeft="20dp"
        android:paddingRight="5dp"
        android:paddingTop="5dp"
        android:text="@string/statbar1" />

    <ProgressBar
        android:id="@+id/persona_statbar1"
        style="?android:attr/progressBarStyleHorizontal"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:layout_alignTop="@id/statlabel1"
        android:layout_margin="1dp"
        android:layout_toRightOf="@id/statlabel1"
        android:indeterminate="false"
        android:maxHeight="15dip"
        android:minHeight="15dip"
        android:paddingTop="5dp"
        android:progress="100"
        android:progressDrawable="@drawable/redprogress" />

    <TextView
        android:id="@+id/statlabel2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignRight="@id/statlabel1"
        android:layout_below="@id/statlabel1"
        android:ellipsize="end"
        android:maxLines="1"
        android:paddingRight="5dp"
        android:paddingTop="5dp"
        android:text="@string/statbar2" />

    <ProgressBar
        android:id="@+id/persona_statbar2"
        style="?android:attr/progressBarStyleHorizontal"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_alignTop="@id/statlabel2"
        android:layout_below="@id/persona_statbar1"
        android:layout_margin="1dp"
        android:layout_toRightOf="@id/statlabel2"
        android:indeterminate="false"
        android:maxHeight="15dip"
        android:minHeight="15dip"
        android:paddingTop="5dp"
        android:progress="100"
        android:progressDrawable="@drawable/redprogress" />

    <TextView
        android:id="@+id/statlabel3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignRight="@id/statlabel2"
        android:layout_below="@id/statlabel2"
        android:ellipsize="end"
        android:maxLines="1"
        android:paddingRight="5dp"
        android:paddingTop="5dp"
        android:text="@string/statbar3" />

    <ProgressBar
        android:id="@+id/persona_statbar3"
        style="?android:attr/progressBarStyleHorizontal"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_alignTop="@id/statlabel3"
        android:layout_below="@id/persona_statbar2"
        android:layout_margin="1dp"
        android:layout_toRightOf="@id/statlabel3"
        android:indeterminate="false"
        android:maxHeight="15dip"
        android:minHeight="15dip"
        android:paddingTop="5dp"
        android:progress="100"
        android:progressDrawable="@drawable/redprogress" />
</RelativeLayout>

<LinearLayout
    android:id="@+id/progress_bar_container"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom"
    android:gravity="center"
    android:orientation="horizontal"
    android:padding="16dp"
    android:visibility="gone" >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:paddingRight="5dp"
        android:text="@string/lovemeter"
        android:textSize="20sp" >
    </TextView>

    <ProgressBar
        android:id="@+id/ProgressBar"
        style="?android:attr/progressBarStyleHorizontal"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:indeterminate="false"
        android:max="100"
        android:maxHeight="35dip"
        android:minHeight="35dip"
        android:progress="1"
        android:progressDrawable="@drawable/redprogress" >
    </ProgressBar>
</LinearLayout>

<Button
    android:id="@+id/again_btn"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:layout_marginTop="1dp"
    android:padding="10dp"
    android:text="@string/again"
    android:textColor="#f0f0f0f0"
    android:visibility="gone"
    android:layout_weight="1" >
</Button>

<com.hookedmediagroup.wasabi.TearRatingView
    android:id="@+id/wasabi_tear_view"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="10dp"
    android:visibility="gone"
    android:layout_weight="1" >
</com.hookedmediagroup.wasabi.TearRatingView>

【问题讨论】:

    标签: xml eclipse android-layout


    【解决方案1】:

    在这里查看我的问题和答案:How to get the graphical layout Window back in Eclipse for Android Application Design?

    这将是您问题的解决方案。

    享受。 :))

    【讨论】:

    • 你有解决方案吗?如果没有,那么让我通知。如果您得到解决方案,请接受答案。所以它可以帮助其他人。
    • 那请放上你的isuue截图。
    • @user1181977 :我没有得到你想要的。如果您没有获得布局,请根据需要单击不同的布局。前任。单击布局或从小部件或任何其他选项。如果仍然无法解决您的问题,请单击“自定义和库视图”并按“刷新”按钮。
    • @请留下您想要的评论。
    • 这里是截图,与之对应的tab是persona_view.xml,在OPsnag.gy/2sVpx.jpg里面我就是想看看我的程序员写的代码不安装每次都将 apk 发送到我的手机。
    【解决方案2】:

    编辑TextView下的可见线如下:

    android:visibility="visible"
    

    而不是

    android:visibility="gone"
    

    【讨论】:

      猜你喜欢
      • 2011-09-02
      • 2018-06-11
      • 2013-03-07
      • 2012-05-25
      • 2012-09-10
      • 2015-10-28
      • 1970-01-01
      • 2014-12-21
      • 1970-01-01
      相关资源
      最近更新 更多