如上所述,我的List项是一个FrameLayout,里面有两个视图.
ColorView 是我在整个视图中为显示颜色制作的自定义视图.
(FrameLayout的高度是"wrap_content")
它似乎在我的ICS设备上运行良好,但在我的Android 2.2模拟器和Android 1.6 G1上不起作用.


<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<org.mariotaku.twidere.view.ColorView
android:id="@+id/status_background"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="@drawable/ic_label_user"/>
<RelativeLayout
android:id="@+id/status_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="6dp"
android:paddingRight="6dp"
android:paddingTop="6dp">
<org.mariotaku.twidere.view.RoundCorneredImageView
android:id="@+id/profile_image"
android:layout_width="@dimen/profile_image_size"
android:layout_height="@dimen/profile_image_size"
android:layout_marginLeft="6dp"
android:scaleType="fitCenter"/>
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignWithParentIfMissing="true"
android:layout_marginLeft="6dp"
android:layout_toLeftOf="@+id/time"
android:layout_toRightOf="@+id/profile_image"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold"/>
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/name"
android:layout_alignParentRight="true"
android:layout_alignWithParentIfMissing="true"
android:layout_below="@+id/name"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"/>
<TextView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/name"
android:layout_alignParentRight="true"
android:layout_alignWithParentIfMissing="true"
android:drawablePadding="3dp"
android:gravity="center_vertical|right"
android:textColor="?android:attr/textColorSecondary"/>
<ImageView
android:id="@+id/image_preview"
android:layout_width="@dimen/preview_image_size"
android:layout_height="@dimen/preview_image_size"
android:layout_alignWithParentIfMissing="true"
android:layout_below="@+id/text"
android:layout_marginLeft="16dp"
android:layout_marginTop="3dp"
android:layout_toRightOf="@+id/profile_image" …Run Code Online (Sandbox Code Playgroud) 我在FrameLayout中有一个WebView,因为我正在创建一个浏览器来添加标签.FrameLayout位于SwipeRefreshLayout内.
问题:每当我在WebView中快速滚动内容时,工具栏后面会出现刷新图标.它应该只在WebView内容位于顶部时才会发生.它与FrameLayout有关,当我删除它时,问题就消失了.
布局如下所示:
<SwipeRefreshLayout
android:id="@+id/swipeRefresh"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<FrameLayout
android:id="@+id/webViewFrame"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<WebView
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>
</SwipeRefreshLayout>
Run Code Online (Sandbox Code Playgroud) android android-webview swiperefreshlayout android-framelayout
我在NestedScrollView中有一个FrameLayout,如
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000">
Run Code Online (Sandbox Code Playgroud)
但是FrameLayout没有填充NestedScrollView的高度.我该如何解决这个问题?
我见过一种方法,在片段的情况下使用frameLayout.最终目标是拥有多个碎片.
android android-layout android-fragments android-framelayout
如何使BottomNavigationView的开头结束FrameLayout?FrameLayout的内容正在被导航视图重叠.
这是xml:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
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:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent" tools:context="...">
<FrameLayout
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent">
</FrameLayout>
<android.support.design.widget.BottomNavigationView
android:id="@+id/navigation"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="0dp"
android:layout_marginStart="0dp"
android:background="?android:attr/windowBackground"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:menu="@menu/navigation" />
</android.support.constraint.ConstraintLayout>
Run Code Online (Sandbox Code Playgroud) 我正在使用以下代码动态创建FrameLayout
mylayout.java
FrameLayout layout = new FrameLayout(this);
FrameLayout.LayoutParams layoutparams=new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,ViewGroup.LayoutParams.FILL_PARENT,Gravity.CENTER_HORIZONTAL|Gravity.CENTER_VERTICAL);
layout.setLayoutParams(layoutparams);
webview=new WebView(this);
webview.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT));
splashview=new ImageView(this);
splashview.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT));
splashview.setScaleType(ScaleType.FIT_XY);
splashview.setImageResource(R.drawable.splash);
splashview.setVisibility(View.INVISIBLE);
progressbar=new ProgressBar(this);
FrameLayout.LayoutParams params=new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,ViewGroup.LayoutParams.MATCH_PARENT,Gravity.CENTER_HORIZONTAL|Gravity.CENTER_VERTICAL);
progressbar.setLayoutParams(params);
progressbar.setVisibility(View.INVISIBLE);
layout.addView(webview);
layout.addView(progressbar);
layout.addView(splashview);
setContentView(layout);
Run Code Online (Sandbox Code Playgroud)
mylayout.xml
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center_vertical|center_horizontal"
android:gravity="center_vertical|center_horizontal" >
<WebView
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</WebView>
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:visibility="invisible" />
<ImageView
android:id="@+id/splashscreen"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@string/myimg"
android:scaleType="fitXY"
android:src="@drawable/splash"
android:visibility="invisible" />
</FrameLayout>
Run Code Online (Sandbox Code Playgroud)
我需要的equalent code for the above xml file in java.我做了什么错?
注意:使用上面的java代码,每个代码都是重叠的.
我使用Framelayour进行点击活动,它在2天之前工作正常,但不知道现在发生的事情它不起作用.
请有人帮助我.
我的代码如下:
设计:
<FrameLayout
android:id="@+id/flWebpre"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<WebView
android:id="@+id/wvWebsite"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<ProgressBar
android:id="@+id/pbWebsite"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/white"
android:layout_gravity="center_horizontal" />
</FrameLayout>
Run Code Online (Sandbox Code Playgroud)
代码:
FrameLayout flWebPre = (FrameLayout) findViewById(R.id.flWebpre);
flWebPre.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if (isExpanded) {
isExpanded = false;
new CollapseAnimation(slidingPanel, panelWidth,
TranslateAnimation.RELATIVE_TO_SELF, 0.70f,
TranslateAnimation.RELATIVE_TO_SELF, 0.0f, 0, 0.0f,
0, 0.0f);
}
}
});
Run Code Online (Sandbox Code Playgroud) 在FrameLayout的XML,我们有通过名称获得属性tools:ignore="MergeRootFrame"是什么MergeRootFrame?
我使用了一层具有半透明背景的framelayout来创建叠加层.但是此叠加层不会阻止触摸事件与其下方的视图进行交互.应如何创建阻止所有触摸事件的叠加层?
我有一个Framelayout,它在运行时添加四个imageview,在中心它包含主图像,用户可以执行不同的操作,但我面临旋转布局视图的问题
目前正在触摸旋转按钮我正在这样做
public void setRotateListener() {
mRotateImage.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
float x = event.getX(0);
float y = event.getY(0);
float theta = getTheta(x, y);
switch (event.getAction() & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_POINTER_DOWN:
theta_old = theta;
break;
case MotionEvent.ACTION_MOVE:
float delta_theta = theta - theta_old;
theta_old = theta;
int direction = (delta_theta > 0) ? 1 : -1;
angle += 3 * direction;
Log.d("Tag", "rotate angle : " + obj.getHeight());
obj.setRotation(angle);
notifyListener(direction);
break;
}
return true; …Run Code Online (Sandbox Code Playgroud)