ConstraintLayout's blueprint does not match the final design - android

As I have updated to Android Studio 2.2, I tried new ConstraintLayout to create a simple Activity. Surprisingly, alpha 8 (currently the most up-to-date) is really buggy, causing multiple resets in the blueprint stage.
The main problem is that all items that I have added through Blueprint are not constrained in the Design tab:
Design and Blueprint
The dependencies:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
//testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.google.android.gms:play-services-appindexing:9.4.0'
compile 'org.apache.openejb:openejb-telnet:3.1.4'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha8'
}
I do remember unchecking or checking some checkmark when creating new Empty Activity. Does it have to do with that?
Activity class extends Activity.
Please help me get rid of bugs of new layout constructor.
XML:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/activity_telnet"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context="xx.xxx.xxxx.TelnetActivity">
<TextView
android:text="IP:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/tv_IP"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"/>
<EditText
android:layout_width="180dp"
android:layout_height="16dp"
android:inputType="text|textPersonName"
android:ems="10"
android:id="#+id/et_IP"
android:layout_marginStart="80dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toRightOf="#+id/tv_IP" android:layout_marginLeft="80dp"
/>
<TextView
android:text="Port:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/tv_port"
app:layout_constraintLeft_toLeftOf="#+id/tv_IP"
android:layout_marginTop="16dp" app:layout_constraintTop_toBottomOf="#+id/tv_IP"/>
<EditText
android:layout_width="180dp"
android:layout_height="16dp"
android:inputType="number"
android:ems="10"
android:id="#+id/et_port"
app:layout_constraintBottom_toBottomOf="#+id/tv_port"
app:layout_constraintLeft_toLeftOf="#+id/et_IP"
/>
<Button
android:text="Connect"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/btn_connect"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginTop="16dp" app:layout_constraintTop_toBottomOf="#+id/et_port"
app:layout_constraintLeft_toLeftOf="parent"
tools:layout_constraintRight_creator="1" tools:layout_constraintLeft_creator="1"
android:onClick="connect (TelnetActivity)"/>
<TextView
android:text="Status:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textView3"
android:layout_marginTop="16dp" app:layout_constraintTop_toBottomOf="#+id/btn_connect"
app:layout_constraintLeft_toLeftOf="parent"/>
<TextView
android:text="Disconnected"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/tv_status"
app:layout_constraintTop_toTopOf="#+id/textView3"
app:layout_constraintLeft_toLeftOf="#+id/et_port"/>
<TextView
android:text="Send msg:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textView4"
android:layout_marginTop="16dp" app:layout_constraintTop_toBottomOf="#+id/textView3"
app:layout_constraintLeft_toLeftOf="#+id/textView3"/>
<EditText
android:layout_height="16dp"
android:ems="10"
android:id="#+id/et_sendMsg"
android:layout_width="180dp" android:inputType="text"
app:layout_constraintBottom_toBottomOf="#+id/textView4"
app:layout_constraintRight_toRightOf="#+id/et_port"/>
<TextView
android:text="Response:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textView5"
android:layout_marginTop="16dp" app:layout_constraintTop_toBottomOf="#+id/textView4"
app:layout_constraintLeft_toLeftOf="parent"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/tv_response"
app:layout_constraintBottom_toBottomOf="#+id/textView5"
app:layout_constraintLeft_toLeftOf="#+id/tv_status"
app:layout_constraintTop_toTopOf="#+id/textView5"/>
<Button
android:text="OK"
android:layout_width="88dp"
android:layout_height="48dp"
android:id="#+id/btn_sendMsg"
app:layout_constraintBottom_toBottomOf="#+id/et_sendMsg"
app:layout_constraintTop_toTopOf="#+id/et_sendMsg"
android:layout_marginBottom="16dp"
android:layout_marginStart="24dp"
app:layout_constraintLeft_toRightOf="#+id/et_port" android:layout_marginLeft="24dp"
app:layout_constraintVertical_bias="0.44" android:onClick="sendMsg (TelnetActivity)"/>
</android.support.constraint.ConstraintLayout>
PS: Restarting Android Studio helped with getting all the elements on the right places, until I moved any of them. After that - everything collapses again.

If you updated from alpha7 to alpha8 (which is probably the case if you downloaded Android Studio 2.2), you may need to rebuild your project and/or do File->Invalidate Caches in Studio -- though restarting Studio should have been enough. Tell me if that works for you.
Also; on which environment are you running? (Windows, Mac, Linux, which JVM...)

Related

android.support.v7.widget.AppCompatTextview Failed to instataniate

i am having problem, failed to instantiate one or more classes.Following classes cannot be instantiate .
android.support.v7.widget.AppCompatTextview
There it is my xml file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:orientation="horizontal">
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/iv_comment_owner_display"
android:layout_width="20dp"
android:layout_height="20dp"
android:src="#drawable/facebook" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="#+id/tv_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Username"
android:textColor="#android:color/black"
android:textStyle="bold" />
<TextView
android:id="#+id/tv_comment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:text=""
android:textColor="#android:color/black" />
</LinearLayout>
</LinearLayout>
AppCompatTextView was added in appcompat-v7:22.1.0
Please check you appcompat version. You have to update your gradle file with this.
clean/Rebuild project from Android Studio,it might help.
If it doesn't try to invalidate caches and restart android studio.
If you have not done,
Try adding the dependencies in your build.gradle(Module:App)
please check the version according to your app
dependencies {
compile 'com.android.support:design:25.3.1'
}
Try putting this code in your layout
<android.support.v7.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Hello world"
android:textSize="18dp"
/>
because i see no AppCompatTextView in your layout.

How to solve a rendering issue with facebook loginbutton?

I am trying to implement facebook into my app. I was following the directions from the facebook developers site, but got stuck on a step which wasn't explained fully, or in my case, assumed I knew what they were talking about.
Either way, I added the facebook sdk, and did all the preliminary steps as required. However when I add the facebook loginbutton to my gameconsole.xml and try to switch it to design view in android studio I get a rendering error.
Here's my gameconsole.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
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"
android:id="#+id/gameconsole_bg">
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="30dp"
android:maxHeight="325dp"
android:adjustViewBounds="true"
/>
<EditText
android:id="#+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/imageView1"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:capitalize="characters"
android:ems="10"
android:gravity="center" />
<TextView
android:id="#+id/editText2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/imageButton2"
android:layout_centerHorizontal="true"
android:layout_marginTop="97dp"
android:ems="5"
android:visibility="invisible"
/>
<TextView
android:id="#+id/editText3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/editText2"
android:layout_below="#+id/imageButton2"
android:ems="5"
android:visibility="invisible"
/>
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/imageView1"
android:layout_centerHorizontal="true"
android:text="#string/pc1"
android:textSize="12sp"
android:textColor="#ffffff" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/help"
android:id="#+id/imageButton3"
android:layout_above="#+id/editText2"
android:layout_toLeftOf="#+id/editText3"
android:layout_toStartOf="#+id/editText3" />
<ImageButton
android:id="#+id/imageButton2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/rateus"
android:layout_marginTop="60dp"
android:layout_below="#+id/editText1"
android:layout_toRightOf="#+id/editText3"
android:layout_toEndOf="#+id/editText3" />
<com.facebook.login.widget.LoginButton
android:id="#+id/login_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:layout_marginBottom="30dp" />
</RelativeLayout>
I've read somewhere that facebook.sdkinitialize must be called first for the UI to work? Ok fine. I put this line of code in my application code
import android.app.Application;
import com.facebook.FacebookSdk;
import com.facebook.appevents.AppEventsLogger;
public class MyApp extends Application {
#Override
public void onCreate() {
super.onCreate();
// Initialize the SDK before executing any other operations,
FacebookSdk.sdkInitialize(getApplicationContext());
AppEventsLogger.activateApp(this);
My real question is what does this matter anyway? I'm not running the program so nothing is being initialized yet. I'm just trying to add the button in design mode BEFORE the program is run. In design mode, no program is being run, or am I wrong? I'm still new to programming and this is giving me a headache. Any help will be appreciated.
Rendering problems are usually related to your dependencies...
try to upgrade the com.android.support:appcompat-v7 like this
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
}
and here is my facebook login button
<com.facebook.login.widget.LoginButton
android:id="#+id/login_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="30dp"
android:layout_marginBottom="30dp" />
I hope this will help!

Weird behavior in EditText

I'm having problems with the behavior of an EditText. Here is the thing:
When I click on the EditText the softKeyboard appears and I still can see the EditText (so I can see what I'm writing). But if I first click on a Button or if I hide the softKeyboard and click again in the EditText then the softKeyboard appears but the EditText is below the softKeyboard.
I've tried several things. My app is fullScreen but I can't find where I set it because I'm not using a custom theme and in my activity I only have this:
<activity
android:name=".Textinput"
android:label="#string/title_activity_textinput"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustResize|stateHidden"/>
The .xml of the activity is:
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout 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"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:context="com.jesusortega.esloganquizz.Textinput"
tools:showIn="#layout/activity_textinput"
android:background="#171c22"
android:gravity="center_vertical"
android:orientation="vertical"
>
<ImageView
android:id="#+id/image"
android:layout_width="220dp"
android:layout_height="220dp"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="#dimen/activity_vertical_margin"
android:layout_marginLeft="#dimen/activity_horizontal_margin"
android:layout_marginRight="#dimen/activity_horizontal_margin"
android:layout_marginTop="#dimen/activity_vertical_margin"/>
<TextView
android:id="#+id/textview1"
android:layout_width="340dp"
android:layout_height="wrap_content"
android:background="#drawable/shadowbuttonblue"
android:textAllCaps="false"
android:textColor="#ffffff"
android:textSize="18sp"
android:gravity="left|center_vertical"
android:layout_gravity="end"
android:paddingEnd="50dp"
android:paddingRight="50dp"
android:paddingLeft="20dp"
android:paddingStart="20dp"
android:paddingBottom="10dp"
android:paddingTop="10dp"
android:layout_marginBottom="8dp"
android:layout_marginRight="-30dp"
/>
<Button
android:id="#+id/button1"
android:layout_width="340dp"
android:layout_height="40dp"
android:background="#drawable/shadowbuttongreen"
android:text="#string/string13"
android:textAllCaps="false"
android:textColor="#ffffff"
android:textSize="18sp"
android:gravity="right|center_vertical"
android:layout_gravity="left"
android:paddingEnd="20dp"
android:paddingRight="20dp"
android:paddingBottom="10dp"
android:paddingTop="10dp"
android:paddingLeft="50dp"
android:layout_marginBottom="8dp"
android:layout_marginLeft="-30dp"
android:onClick="function1"
/>
<Button
android:id="#+id/button2"
android:layout_width="340dp"
android:layout_height="40dp"
android:background="#drawable/shadowbuttonyellow"
android:text="#string/string14"
android:textAllCaps="false"
android:textColor="#ffffff"
android:textSize="18sp"
android:gravity="left|center_vertical"
android:layout_gravity="end"
android:paddingLeft="20dp"
android:paddingBottom="10dp"
android:paddingTop="10dp"
android:layout_marginBottom="8dp"
android:layout_marginRight="-30dp"
android:onClick="function1"
/>
<EditText
android:id="#+id/editText1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/string15"
android:textColorHint="#ffffff"
android:padding="10dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
android:layout_marginBottom="8dp"
android:background="#drawable/introducirtexto"
android:gravity="center_horizontal"
android:layout_gravity="center_horizontal"
android:textSize="18sp"
android:textColor="#ffffff"
android:textCursorDrawable="#null"
android:imeOptions="actionGo"
android:singleLine="true"/>
<Button
android:id="#+id/button3"
android:layout_width="340dp"
android:layout_height="40dp"
android:background="#drawable/shadowbuttonred"
android:text="#string/string16"
android:textAllCaps="false"
android:textColor="#ffffff"
android:textSize="18sp"
android:gravity="right|center_vertical"
android:layout_gravity="left"
android:paddingEnd="20dp"
android:paddingRight="20dp"
android:paddingBottom="10dp"
android:paddingTop="10dp"
android:layout_marginLeft="-30dp"
android:onClick="check"
/>
</LinearLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|right"
android:layout_margin="10dp">
<Button
android:id="#+id/esquina"
android:layout_width="70dp"
android:layout_height="40dp"
android:drawableLeft="#drawable/small_coin"
android:background="#drawable/shadowbuttonblue"
android:padding="5dp"
android:textAllCaps="false"
android:textColor="#ffffff"
android:textSize="22sp"
android:onClick="coins"/>
</RelativeLayout>
I know the adjustResize doesn't work in full screen but that's no important for me, I just want to see the EditText every time I click in it.
Thanks.
Edit:
This is my gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.untoj.app"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
}
In AndroidManifest.xml for your activity add:
android:windowSoftInputMode="adjustPan|adjustResize"
Depending on what behavior you would like to implement you could use also:
android:windowSoftInputMode="adjustResize"
Here is description of both options:
"adjustResize" - The activity's main window is always resized to make room for the soft keyboard on screen.
"adjustPan" - The activity's main window is not resized to make room for the soft keyboard. Rather, the contents of the window are automatically panned so that the current focus is never obscured by the keyboard and users can always see what they are typing. This is generally less desirable than resizing, because the user may need to close the soft keyboard to get at and interact with obscured parts of the window.
I've been searching for a while (not the first time I do) and I found something I can call a "solution" thanks to Thair Jaber -> https://stackoverflow.com/a/33649590/6109180
He said that it seems to be a bug. If i remove the gravity in the EditText it works like it should.
Thanks for the help anyway.

How to apply Material Design Facebook button in android

I'm using compile 'com.facebook.android:facebook-android-sdk:4.7.0'
and:
<com.facebook.login.widget.LoginButton
android:id="#+id/tutorial_button_login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="16dp"
/>
But the button looks so ugly:
Is there any way to make it look materialized or more cooler?
I tried to mimic the Material raised button described in Google's Material Design specifications, this is what I could do :
To cover pre-lollipop versions, I used the properties of the CardView support library :
compile 'com.android.support:cardview-v7:23.1.0'
I put the LoginButton inside the CardView :
<android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="6dp"
card_view:cardBackgroundColor="#ffd9d9d9"
card_view:cardCornerRadius="2dp"
card_view:cardElevation="6dp">
<com.facebook.login.widget.LoginButton xmlns:fb="http://schemas.android.com/apk/res-auto"
android:id="#+id/login_button"
android:layout_width="190dp"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-medium"
android:paddingBottom="12dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="12dp"
android:textAllCaps="true"
android:textColor="#android:color/white"
fb:com_facebook_login_text="log in with facebook"
fb:com_facebook_logout_text="log out from facebook" />
</android.support.v7.widget.CardView>
To remove the little f icon from the original login button, I added this to the java LoginButton instannce :
mButtonLogin.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null);
I ended up setting paddings.
<com.facebook.login.widget.LoginButton
android:id="#+id/tutorial_button_login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:paddingBottom="16dp"
android:paddingTop="16dp"
android:paddingRight="16dp"
android:paddingLeft="16dp"
android:layout_marginBottom="#dimen/activity_vertical"
/>

Android Percent Support Library Blank Screen on Actual Device

I tried using the Percent Support Library as detailed here and here. It works nicely in the Android Studio designer, but when I try to install my app into my phone, nothing is showing but an empty screen. What might the problem be?
Edit:
I've added the following lines in my gradle file dependencies.
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:support-v4:23.0.0'
compile 'com.android.support:design:23.0.0'
compile 'com.android.support:percent:23.0.0'
And here is my fragment layout:
<RelativeLayout 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" tools:context="org.atpms.fairfare.ReportFragment"
android:id="#+id/fragment_report" >
<ProgressBar android:id="#+id/report_progress" style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content" android:layout_height="match_parent"
android:layout_marginBottom="8dp" android:visibility="gone"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true" />
<RelativeLayout
android:id="#+id/report_form"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/reportButton"
android:gravity="center">
<ImageView
android:id="#+id/report_background"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:src="#drawable/report"
android:adjustViewBounds="true" />
<android.support.percent.PercentRelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignTop="#+id/report_background"
android:layout_alignBottom="#+id/report_background"
android:layout_alignLeft="#+id/report_background"
android:layout_alignStart="#+id/report_background"
android:layout_alignRight="#+id/report_background"
android:layout_alignEnd="#+id/report_background">
<EditText
android:id="#+id/plateNumberField"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_widthPercent="58%"
app:layout_heightPercent="14%"
app:layout_marginTopPercent="20%"
app:layout_marginLeftPercent="36%"
android:textColor="#color/plate_number"
android:background="#null"
android:gravity="center"
android:textSize="24sp"
tools:ignore="TextFields"/>
<ImageView
android:id="#+id/meterPictureButton"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_widthPercent="12%"
app:layout_heightPercent="15.5%"
app:layout_marginTopPercent="38%"
app:layout_marginLeftPercent="84%"
android:src="#drawable/camera" />
<ImageView
android:id="#+id/meterPicture"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_widthPercent="97.2%"
app:layout_heightPercent="42%"
app:layout_marginTopPercent="55.8%"
app:layout_marginLeftPercent="1.6%"
android:scaleType="fitXY"
tools:ignore="ContentDescription" />
</android.support.percent.PercentRelativeLayout>
</RelativeLayout>
<Button
android:id="#+id/reportButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/report"
android:layout_alignParentBottom="true"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:background="#drawable/report_button"
android:textSize="20sp"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:textColor="#color/button_text"
android:textAllCaps="false"
android:gravity="center"
tools:ignore="UnusedAttribute" />
</RelativeLayout>
</RelativeLayout>
Update:
Ok, I've inflated the exact same layout from an Activity using setContentView, and it works fine. It seems that the problem only arises when I try to use the PercentRelativeLayout in a Fragment layout. It appears that LayoutInflater isn't correctly inflating a layout with PercentRelativeLayout elements, but I'm still unsure and continuing to investigate.
It's not a very nice solution, but I solved this problem by just getting rid of the fragment, and making it a full-blown activity.

Categories

Resources